Hi,
Can you tell how to retrieve token list value from database.
Thanks for advance
Hi,
Can you tell how to retrieve token list value from database.
Thanks for advance
Hello @karthikeyanvijayabalan
First of all, the TokenList
component is bound with Datasources
or Containers
, it doesn’t work directly with database.
Let’s look at an example:
<!-- Screen layout -->
<data>
<instance id="orderDc"
class="com.haulmont.sampler.entity.Order"
view="order-edit">
<loader/>
<collection id="orderItemsDc"
property="items"/>
</instance>
<collection id="allItemsDc"
class="com.haulmont.sampler.entity.OrderItem"
view="orderItem-with-product">
<loader id="orderItemsLoader">
<query>
<![CDATA[select e from sampler$OrderItem e]]>
</query>
</loader>
</collection>
</data>
<layout>
<tokenList id="linesList"
dataContainer="orderDc"
property="items"
width="320px">
<lookup optionsContainer="allItemsDc"/>
</tokenList>
</layout>
So we can get a value like this:
// Screen controller
@Inject
private TokenList<OrderItem> linesList;
private void foo() {
// list of items contained in "orderDc" container returned
List<OrderItem> items = linesList.getValue();
}
Regards,
Daniil
Thank you