5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Visualforce apex:attributeでオブジェクトのリストを受け取る方法

Last updated at Posted at 2020-07-21

カスタムコンポーネントでの値の受渡し

カスタムコンポーネントを作り、親pageから値を渡し

<c:ZZ_ReturnManagementSlipBasecopyCommon xxx="{!xxxx}" />

受け取る時に apex:attribute を使用すると思います。
その際、受け取るときに型指定が必要になりますが、オブジェクトのリストってどうやって渡すんだろうとなりました。

<apex:attribute name="xxx" type="xxx" description="xxx" required="xxx" />

オブジェクトのリストを渡す場合は?

文字列ならstring、数値ならintegerとそのまま指定してあげればいいですが、

List<オブジェクト>を渡す場合の型指定は、 オブジェクト名[] で受け取ることができます。


type="Shop__c[]"

<apex:attribute name="shopList" type="Shop__c[]" description="店舗リスト" required="true" />

listを渡すから、listと指定だよねと思い type="list” と書いていたのですが、その場合、配列にキャストされるようでフィールドへのアクセスが出来ず四苦八苦しました。。

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?