1

Get all rows in zk grid (mold='paging')

asked 2013-10-31 06:53:44 +0800

Weasley gravatar image Weasley
11 2

Hi everyone

I had a paged grid on my pages, I want to get all rows in the grid but when i use the getRows() method, it only return the current page rows. Please tell me some hints.

Thanks

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2015-04-10 09:15:18 +0800

echarish gravatar image echarish flag of Japan
1809 7
http://jp.linkedin.com/in...

Hello

If you want all the rows of the grid, my suggestion is to simply get the model of the grid by calling getModel method of grid, than you will have all the rows of model, than you can perform your operation and notify the change to zul.

harish

link publish delete flag offensive edit
1

answered 2015-04-13 07:32:45 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2015-04-13 07:33:29 +0800

Hey all,

I had the same problem when exporting a grid or listbox with paging to a excelsheet. I had only the first page exported and not the whole thing.

Mine solution was :

@Command
public void renderMeshElementAndExport(@ContextParam(ContextType.BINDER) Binder binder, @BindingParam("ref") MeshElement meshElement,
        @BindingParam("name") String name) {
    if (meshElement instanceof Grid) {
        ((Grid) meshElement).renderAll();
    } else if (meshElement instanceof Listbox) {
        ((Listbox) meshElement).renderAll();
    }
    Map<String, Object> args = new HashMap<>();
    args.put("ref", meshElement);
    args.put("name", name);
    binder.postCommand("exportMeshElementToExcel", args);
}

Quick explication :

The renderAll() will render all the rows of the listbox or grid. The only catch is that this is done at the client side.
So as long we don't go back to the client side the element doesn't render the rows.

Then we have 2 options, we can do a echo event but with MVVM I doesn't want to interact to the eventqueue myself if not needed.

So I came up to the solution, when you post a new command from the binder, you have the same effect as echo event. (You go to client side and then come back)
So the last line for me is calling the command for exporting, but you can change that to whatever command you need.
See also how I fill the Map for the BindingParam in the new command.

Greetz chill.

link publish delete flag offensive edit
0

answered 2015-04-10 01:10:20 +0800

Julio8080 gravatar image Julio8080
1

I happen the same and I can not find the solution!

link publish delete flag offensive edit

Comments

Mvvm? If yes wait till after weekend and i'll post you the solution.

chillworld ( 2015-04-10 06:32:57 +0800 )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: 2013-10-31 06:53:44 +0800

Seen: 43 times

Last updated: Apr 13 '15

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