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

Using a custom paging with a mesh component in MVVM cause ListModelList pageSize to be reset

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.0.2
    • 8.0.1.1
    • Databind 2
    • Security Level: Jimmy
    • None
    • ZK 8.0.2 S2
    • None

      When binding a custom paging to a Listbox (or other mesh component), if the listbox currently has a ListModel as a model, the ListModel pageSize will be set to the current Paging pageSize value.

      If the paging initialize after the Listbox, the default pageSize value for the paging component will be set to the ListModel instead of the intended value.
      The ListModel page value is not updated afterwards, which cause the Listbox to revert to a pageSize of 20 on the next navigation.

      reproduce with:
      test.zul:

      <zk>
      	<div viewModel="@id('vm')@init('ListboxPagingViewModel')">
      		<listbox model="@init(vm.myModel)" mold="paging" paginal="@init(myPaging)"/>
      		<paging id="myPaging" pageSize="@init(vm.myPageSize)"/>
      	</div>
      </zk>
      

      ListboxPagingViewModel.java

      public class ListboxPagingViewModel {
      
      	private ListModelList myModel;
      	private int myPageSize;
      	
      	@Init
      	public void init(){
      		myPageSize = 5;
      		myModel = new ListModelList(Locale.getAvailableLocales());
      	}
      	
      	public ListModelList getMyModel() {
      		return myModel;
      	}
      	public int getMyPageSize() {
      		return myPageSize;
      	}
      }
      
      

            christopherszu christopherszu
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h