Announcement

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

    totalRows from DSResponse is not correct

    SmartGWT 2.5 IE8

    I am using RestDataSource,

    here are the code:
    Code:
    restDataSource = new RestDataSource() {
              @Override
    	protected Object transformRequest(DSRequest dsRequest) {
    		String field = listGrid.getSortField();
    		SortDirection sd = listGrid.getSortDirection();
    		String direct = sd.getValue();
    
    		String url2 = url + "?action=" + Constans.ACTION_LIST_MEMBER_BY_STORE + "&start=" + dsRequest.getStartRow() + "&end="
    						+ dsRequest.getEndRow() + "&storeID=" + storeID + "&field=" + field + "&direct=" + direct;
    		url2 = url2.replaceAll("\"", "");
    
    		dsRequest.setActionURL(url2);
    		return super.transformRequest(dsRequest);
    	}
    
    	protected void transformResponse(com.smartgwt.client.data.DSResponse response, DSRequest request, Object data) {
    	        System.out.println(response.getTotalRows());
    		super.transformResponse(response, request, data);
    	};
    };
    restDataSource.setDataFormat(DSDataFormat.JSON);

    the result of response.getTotalRows() is same as endRow, the first time both endRow and totalRows are 75, but actually totalRows is much more than 75, when i drag the scrollbar, the totalRows changes, but it is also same as endrow.

    How can I get the real totalRow?
    Thanks so much!

    #2
    Seeing the same behavior. The only solution we came up with is to add a DataArrivedHandler and then doing listGrid.getResultSet().getLength() which may or may not return the correct number :(

    Comment


      #3
      Call super, *then* check totalRows. Otherwise, the response from the server has not yet been parsed by RestDataSource.

      Comment

      Working...
      X