Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1895

Paging on listbox with onFulfill

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.5.1
    • Fix Version/s: 6.5.4
    • Component/s: Components, Databind 2
    • Security Level: Jimmy
    • Labels:
      None

      Description

      Please refer to http://forum.zkoss.org/question/88408/paging-on-listbox-with-onfulfill/

      Edit:

      ROD should be enabled, e.g., add the fragment below into zk.xml

      <library-property>
          <name>org.zkoss.zul.listbox.rod</name>
          <value>true</value>
      </library-property>
      

        Activity

        Hide
        benbai benbai added a comment -

        Workaround:
        override listbox as below:

        <zk xmlns:w="client">
        	<listbox ...>
        		<attribute w:name="bind_"><![CDATA[
        			function (a, b, c) {
        				this.$bind_(a, b, c);
        				var rows = this.ebodyrows;
        				if (this && rows && !rows[0]) {
        					this.fire('onPageSize', {size: 10});
        				}
        			}
        		]]></attribute>
        	...
        
        Show
        benbai benbai added a comment - Workaround: override listbox as below: <zk xmlns:w="client"> <listbox ...> <attribute w:name="bind_"><![CDATA[ function (a, b, c) { this.$bind_(a, b, c); var rows = this.ebodyrows; if (this && rows && !rows[0]) { this.fire('onPageSize', {size: 10}); } } ]]></attribute> ...
        Hide
        jumperchen jumperchen added a comment -

        Upload test case

        Show
        jumperchen jumperchen added a comment - Upload test case
        Hide
        jumperchen jumperchen added a comment -

        The issue is caused by MVVM's setModel timing.

        Wrong case - onFulFill -> onPageAttached -> onInitModel (model is null in this timing) -> setModel(MVVM - too late)
        Correct case - onFulFill -> onPageAttached -> setModel() -> onInitModel (model won't be null)

        Show
        jumperchen jumperchen added a comment - The issue is caused by MVVM's setModel timing. Wrong case - onFulFill -> onPageAttached -> onInitModel (model is null in this timing) -> setModel(MVVM - too late) Correct case - onFulFill -> onPageAttached -> setModel() -> onInitModel (model won't be null)
        Hide
        dennis dennis added a comment - - edited

        Could reproduce with following code without mvvm

        <window border="none" width="100%" height="100%" id="test">
            <zscript><![CDATA[
            void setModel(){
            	ListModelList model = new ListModelList();
            	for(int i=0;i<100;i++){
            		model.add("A"+i);
        		}
            	listbox.setModel(model);
            }
            ]]></zscript>
            <listbox id="listbox" vflex="true" mold="paging"
            	autopaging="true" onCreate="setModel()">
            	<listhead>
            		<listheader sort="auto">Title</listheader>
            	</listhead>
            	<template name="model">
            		<listitem>
            			<listcell label="${each}" />
            		</listitem>
            	</template>
            </listbox>
        </window>
        
        Show
        dennis dennis added a comment - - edited Could reproduce with following code without mvvm <window border= "none" width= "100%" height= "100%" id= "test" > <zscript><![CDATA[ void setModel(){ ListModelList model = new ListModelList(); for ( int i=0;i<100;i++){ model.add( "A" +i); } listbox.setModel(model); } ]]></zscript> <listbox id= "listbox" vflex= " true " mold= "paging" autopaging= " true " onCreate= "setModel()" > <listhead> <listheader sort= "auto" >Title</listheader> </listhead> <template name= "model" > <listitem> <listcell label= "${each}" /> </listitem> </template> </listbox> </window>
        Hide
        jumperchen jumperchen added a comment -

        Bug fixed since 8/27/2013

        Show
        jumperchen jumperchen added a comment - Bug fixed since 8/27/2013

          People

          • Assignee:
            jumperchen jumperchen
            Reporter:
            benbai benbai
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: