-
FEATURED COMPONENTS
First time here? Check out the FAQ!
What is the strategy for updating a grid from the server? I have a grid and I have a set of components which are used to set some variables that will be used as filter criteria.
When the search button is pressed it updates the entity bean on the server so that a query can be made with the final data source.
This all works fine but I can't see a way to trigger the grid to update on the client side so that it displays the new data.
Are there specific API calls I should use to implement this?
The .zul
<grid id="myGrid"
model="${$composer.myModel}"
rowRenderer="com.MyRenderer">
<auxhead>
<auxheader colspan="2" class="topic">Title</auxheader>
</auxhead>
<columns menupopup="auto">
<column label="Field1" width="15%" align="left"/>
<column label="Field2" width="85%" align="left"/>
</columns>
</grid>
Most of the examples I have seen don't use the RowRenderer method and bind the data in the .zul file but I would perfer to use the RowRenderer method. I beleive I am not using the mvvm method. Is there a way to use MVVM and the RowRenderer method at the same time?
Hello bobtedbob,
Following is a sample using a listbox with a itemRenderer.
<listbox model="@load(vm.model)" itemRenderer="test.myRenderer">
<listhead>
<listheader width="100%" sort="auto(name)" label="User Name" />
</listhead>
</listbox>
If you need a full sample please let me know so i can create one.
Best Regards,
Darksu
Hello bobtedbob,
Continuing chillworld's comment, if you want to update the data on your application with mvvm (my preference) you can use notification.
For more information please refer to the following:
http://books.zkoss.org/zk-mvvm-book/8.0/viewmodel/notification.html
Best Regards,
Darksu
Asked: 2015-10-07 08:24:35 +0800
Seen: 43 times
Last updated: Oct 07 '15
please add your code or example code. ZK has functionality to update client side but we can't help with this now. We don't even know if you use MVC or MVVM
chillworld ( 2015-10-07 08:34:13 +0800 )editUpdated the post with more information, if there is anything else you'd like to see please ask
bobtedbob ( 2015-10-07 09:18:32 +0800 )editAs @Darksu already said, it's possible : for grid :
chillworld ( 2015-10-07 09:54:43 +0800 )editmodel="@load(vm.myModel)" rowRenderer="be.chillworld.web.renderers.MyRenderer"
But you need to change your controller to a viewmodel. (other declaration in zul and class doesn't need to extend or implement a class/interface)@darkdu + @chillworld. Thanks for your help, converting to MVVM and using notifications worked.
bobtedbob ( 2015-10-07 13:32:16 +0800 )edit