Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid Paging

    Hi there ...
    I've another question for you.
    I have a RestDataSource that is calling some data threw a service that displays some XML. Everything is fine, until I ask a large amount of data.
    In the showcase, a sample is provided, I've done the same but my ListGrid doesn't paginate anything.

    Here is the XML resulted :
    Code:
    <response>
    <status>0</status>
    <startRow>0</startRow>
    <endRow>75</endRow>
    <totalRows>1448</totalRows>
    <data>
    <transportResult>
    <itucode>050424040</itucode>
    <lastStatus>50</lastStatus>
    <terminals>202<br/>245<br/>null</terminals>
    <fullOrEmpty>1</fullOrEmpty>
    <weights>3156<br/>2800</weights>
    <statusDate>Thu Feb 26 06:20:04 CET 2009</statusDate>
    <departureDate>Wed Feb 25 19:11:04 CET 2009</departureDate>
    <actors>0018210<br/>0018214<br/>0018214</actors>
    <refNumbers>NON COMMUNIQUEE<br/>NRUNG2057904</refNumbers>
    <controlNumbers>050061<br/>050061<br/>338749086033</controlNumbers>
    </transportResult>
    ...
    </data>
    The interesting part is this one :
    <startRow>0</startRow>
    <endRow>75</endRow>
    <totalRows>1448</totalRows>

    My listGrid only displays the 75 first result, and does not provide anything to load the next results ... How can I do that?

    Thanks for the reply!

    #2
    anybody have an idea how to make this work?
    I'm seraching since yesterday about this but all I find are useless tips for old SmartGwt releases ...

    Comment


      #3
      Ok I've found a new fact :

      when I use the built-in filter, it makes the correct GET request, with the correct pagination.
      When I use my Filter, it doesn't care about the pagination.

      Here is some code I wrote :
      - listgrid configuration
      Code:
      listGrid.setAutoFetchData(true);
      listGrid.setShowFilterEditor(true);
      listGrid.setFilterOnKeypress(true);
      listGrid.setDataSource(dataSource);
      - onclick filter action
      Code:
      changeButton.addClickHandler(new ClickHandler() {
      	public void onClick(ClickEvent arg0) {
      		Criteria c = new Criteria("itucode",nameField.getText());
      		dataSource.fetchData(c,new DSCallback () {
      			public void execute(DSResponse response, Object rawData, DSRequest request) {
      				listGrid.setData(response.getData());
      				startRow.setText(response.getStartRow().toString());
      				endRow.setText(response.getEndRow().toString());
      				totalRows.setText(response.getTotalRows().toString());
      			}
      		});
      	}
      });
      another question, if I directly use the listgrid methods (setCriteria and fetchData() ) no request is made at all ... is that normal ?

      I does not understand why, when I call this following code, ther is no raction from smart GWT. It seems that the code is just not run. According to the javadoc, it should bet the same as my filter ( Values entered into this row are used as filter criteria to filter this List's data on enter-keypress or filter button click. autoFetchTextMatchStyle determines the textMatchStyle for the request passed to ListGrid.fetchData. )
      Code:
      changeButton.addClickHandler(new ClickHandler() {
      	public void onClick(ClickEvent arg0) {
      		Criteria c = new Criteria("itucode",nameField.getText());
      		listGrid.setCriteria(c);
      		listGrid.fetchData();
      	}
      });
      Last edited by romain.vdk; 24 Jun 2010, 04:04.

      Comment

      Working...
      X