0

Triggering a grid to reload its data from the server

asked 2015-10-07 08:24:35 +0800

bobtedbob gravatar image bobtedbob
17 3

updated 2015-10-07 09:16:48 +0800

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?

delete flag offensive retag edit

Comments

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 )edit

Updated 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 )edit

As @Darksu already said, it's possible : for grid : model="@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)

chillworld ( 2015-10-07 09:54:43 +0800 )edit

@darkdu + @chillworld. Thanks for your help, converting to MVVM and using notifications worked.

bobtedbob ( 2015-10-07 13:32:16 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-10-07 09:39:36 +0800

Darksu gravatar image Darksu
1991 1 4

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

link publish delete flag offensive edit
0

answered 2015-10-07 08:58:34 +0800

Darksu gravatar image Darksu
1991 1 4

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

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-10-07 08:24:35 +0800

Seen: 43 times

Last updated: Oct 07 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More