-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I was using MVVM pattern and used @converter on data which worked seamlessly.
Due to version change, MVVM pattern cause some exception So we decided to work with MVC.
How to apply converter on data. Please help me write the appropriate code. where I go wrong in the following code. Watch out the first listcell tag of Listbox
<window id="win" apply="com.saidigital.qspj.backoffice.gui.controller.InvoiceSequenceController"
validationMessages="@id('vmsgs')" onOpen="@globalCommand('loadPage')">
<toolbar>
<toolbarbutton id="addGuiSequenceButton" sclass="z-toolbarbutton" label="${c:l('gui_sequence_toolbar_add_button')}" onClick="@command('guiCreateModel')" width="140px"/>
<toolbarbutton id="closeGuiSequenceButton" sclass="z-toolbarbutton" disabled="${not win$composer.enableCloseGuiSequenceButton}" label="${c:l('gui_sequence_toolbar_close_button')}" onClick="@command('closeGUISequence')" width="100px"/>
<toolbarbutton id="openGuiSequenceButton" sclass="z-toolbarbutton" disabled="${not win$composer.enableOpenGuiSequenceButton}" label="${c:l('gui_sequence_toolbar_open_button')}" onClick="@command('openGUISequence')" width="100px"/>
<toolbarbutton id="stopGuiSequenceButton" sclass="z-toolbarbutton" disabled="${not win$composer.enableStopGuiSequenceButton}" label="${c:l('gui_sequence_toolbar_stop_button')}" onClick="@command('stopGUISequence')" width="100px"/>
<toolbarbutton id="activeGuiSequenceButton" sclass="z-toolbarbutton" disabled="${not win$composer.enableActiveGuiSequenceButton}" label="${c:l('gui_sequence_toolbar_active_button')}" onClick="@command('activeGUISequence')" width="100px"/>
</toolbar>
<listbox id="guiSequenceListTable"
model="${win$composer.guiSequenceModelList}" selectedItems="@{win$composer.selectedGUISequenceSet}" checkmark="true"
multiple="true" mold="paging" pageSize="10" emptyMessage="GUI sequence numbers are not available.">
<listhead>
<listheader width="32px" />
<listheader label="${c:l('gui_sequence_add_year')}" sortAscending="${cStartDateAsc}" sortDescending="${cStartDateDsc}"/>
<listheader label="${c:l('gui_sequence_add_month')}" sortAscending="${cEndDateAsc}" sortDescending="${cEndDateDsc}" />
<listheader label="${c:l('gui_sequence_prefix')}" sortAscending="${cPrefixAsc}" sortDescending="${cPrefixDsc}" />
<listheader label="${c:l('gui_sequence_seq_no')}" />
<listheader label="${c:l('gui_sequence_number_from')}" />
<listheader label="${c:l('gui_sequence_number_to')}" />
<listheader label="${c:l('gui_sequence_next_number')}" />
<listheader label="${c:l('gui_sequence_remaining_numbers')}" />
<listheader label="${c:l('gui_sequence_status')}" sortAscending="${cStatusAsc}" sortDescending="${cStatusDsc}" />
<listheader label="${c:l('gui_sequence_close_status')}" sortAscending="${cCloseStatusAsc}" sortDescending="${cCloseStatusDsc}" />
</listhead>
<template name="model">
<listitem>
<listcell />
<listcell label="${each.startDate} @converter(${win$composer.yearConverter})" />
<listcell label="${each.endDate}" />
<listcell label="${each.guiPrefix}" />
<listcell label="${each.sequenceNumber}" />
<listcell label="${each.numberFrom}" />
<listcell label="${each.numberTo}" />
<listcell label="${each.nextNumber}" />
<listcell label="${each.remainingNumbers}" />
<listcell label="${each.guiStatus ne null and each.guiStatus eq 'S' ? c:l('gui_sequence_status_STOP') : c:l('gui_sequence_status_ACTIVE')}" />
<listcell label="${each.guiCloseStatus ne null and each.guiCloseStatus eq 'Y' ? c:l('gui_sequence_close_status_CLOSED') : c:l('gui_sequence_close_status_ACTIVE')}" />
</listitem>
</template>
</listbox>
</window>
Just use @init in the line you want to use these converter
Asked: 2017-12-29 13:27:07 +0800
Seen: 9 times
Last updated: Dec 29 '17
Lol, still MVVM if i look at your code.
chillworld ( 2017-12-31 14:11:44 +0800 )editcan you give me sample code using converter using MVC Pattern?
ansarism ( 2018-01-02 12:28:45 +0800 )editI don't think you understand the consequences of that. @command, @global-command will not work anymore. Beside => the
chillworld ( 2018-01-02 12:42:25 +0800 )edit@{}
is wrong MVVM usage, please use @bind for it with the selectedItem. If your problem comes from the@{}
, change to `@init, @load, @save or @bind and your problems are solved