Mvvm? If yes wait till after weekend and i'll post you the solution.
chillworld ( 2015-04-10 06:32:57 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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
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.
I happen the same and I can not find the solution!
Mvvm? If yes wait till after weekend and i'll post you the solution.
chillworld ( 2015-04-10 06:32:57 +0800 )editAsked: 2013-10-31 06:53:44 +0800
Seen: 43 times
Last updated: Apr 13 '15