0

ClientInfoEvent using MVVM

asked 2014-10-05 22:08:34 +0800

PeteMorgan gravatar image PeteMorgan
3 2

Hello

I'm attempting to get the height of the browser so I can adjust the number of records in a list.

I've attempted this:

   <listbox model="@load(vm.customers)" onClientInfo="@command('onClientInfo',evt=event)" height="100%"> .... </listbox>

And on the view model:

    @Command
    public void onClientInfo(@ContextParam(ContextType.TRIGGER_EVENT) ClientInfoEvent evt) {
        ....
     }

However it did not seem to call my operation when the page loaded.

Any help gratefully received.

Kind regards

Pete

delete flag offensive retag edit

Comments

Sorry I cannot use autopaging as the data set being read is very large and I need to read a page at a time from the database - server side pagination as opposed to client side. I believe autopaging is client side in that it assumes a full data set and then pages on that in memory.

PeteMorgan ( 2014-10-06 09:09:57 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-10-07 08:18:35 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2014-10-07 08:22:29 +0800

onClientInfo works ONLY on the outer most window component.

zul:

<window width="100%" height="100%" 
        onClientInfo="@command('updateClientInfo', width=event.desktopWidth, height=event.desktopHeight, orientation=event.orientation)" >

    <listbox model="@load(vm.customers)" . . .

java:

@Command()
public void updateClientInfo(@BindingParam("orientation") String _orientation, 
             @BindingParam("width") int _width,  @BindingParam("height") int _height) {
. . .

best Stephan

PS: Complete code about the responsive stuff (i.e. calculate pageSize by browser resize) comes end of month with the ZKBoost documentation.

link publish delete flag offensive edit
0

answered 2014-10-06 08:35:07 +0800

cyiannoulis gravatar image cyiannoulis
1191 10

I am not sure if i understand your problem correctly. You need a way to determine the "pageSize" attribute depending on the height of your browser? Then why don't you use the "autopaging" property? It works very nice and recalculates automatically the visible number of rows on each page. The only drawback i 've came accross is that the rows should have a fixed height (or else zk will have problems trying to recalculate the page size). This can be done easily declaring a style like this:

.z-listbox-autopaging .z-listcell-cnt {
    height: 60px;
    overflow: hidden;
}

with a listbox declaration like this:

<listbox mold="paging" autopaging="true" ... >

Hope that helps

Costas

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
2 followers

RSS

Stats

Asked: 2014-10-05 22:08:34 +0800

Seen: 42 times

Last updated: Oct 07 '14

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