Announcement

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

    Not able to load record in ListGrid

    We are using Smart Gwt-5.1
    Browser: Google Chrome
    version: 47.0.2526.106 m
    Issue: ListGrid not able to display record if it’s in between 30 - 40 and
    Resolution: 1280 X 1024 and 1280 X 960

    We added property to fetch 30 record in batch. But after loading 30 records if we do scroll down to
    Fetch next 30 data so it’s not able to load because it’s not calling API to fetch next records.
    Below property we have used:
    printGrid.setDataSource(countryDS);
    printGrid.setAutoFetchData(true);
    printGrid.setDataFetchMode(FetchMode.PAGED);
    printGrid.setDataPageSize(30);

    Note: This issue is happening only in above mention resolution.

    #2
    We're not seeing this issue - we would guess that it probably results from incorrect responses from your server or a similar problem.

    As a first step, you should post the logs from the Developer Console with the ResultSet category set to DEBUG, and the requests and responses from the RPC tab.

    Comment


      #3
      Hi,
      Thank you for your reply.

      Please have a look for below codes which we are using to send request and getting response.

      UI code:

      public void createGrid(){

      ListGrid sampleGrid = new ListGrid();

      ListGridField classifictionField = new ListGridField(fieldNames.getClassification(), "Type");
      ListGridField dateField = new ListGridField(fieldNames.getTimestamp(),"Date and Time");
      dateField.setSortByDisplayField(true);
      dateField.setType(ListGridFieldType.DATETIME);
      ListGridField operationField = new ListGridField(fieldNames.getCommandCode(), "Operation");
      ListGridField resultField = new ListGridField(fieldNames.getResult(), "Result");


      sampleGrid.setFields(classifictionField, dateField, operationField, resultField);

      sampleGrid.setWidth100();
      sampleGrid.setHeight100();
      sampleGrid.setMargin(10);
      sampleGrid.setLeaveScrollbarGap(false);
      sampleGrid.setShowRollOver(false);
      sampleGrid.setShowFilterEditor(false);
      sampleGrid.setCanAutoFitFields(false);
      sampleGrid.setCanResizeFields(true);
      sampleGrid.setFixedRecordHeights(false);

      sampleGrid.setFetchDelay(500);
      sampleGrid.setWarnOnRemoval(true);
      sampleGrid.setShowRecordComponents(true);
      sampleGrid.setShowRecordComponentsByCell(true);

      //Pagination Support
      sampleGrid.setDataSource(GroupOperationLogDSDummy.getInstance());
      sampleGrid.setAutoFetchData(true);
      sampleGrid.setDataFetchMode(FetchMode.PAGED);
      sampleGrid.setDataPageSize(30);


      sampleGrid.setCanMultiSort(false);
      sampleGrid.setMargin(0);
      sampleGrid.setCellHeight(30);
      sampleGrid.setHeaderHeight(30);
      sampleGrid.setSortField(fieldNames.getTimestamp());

      VLayout layout = new VLayout();
      layout.setWidth100();
      layout.setHeight100();
      layout.setOverflow(Overflow.HIDDEN);
      Canvas sampleCanvas = new Canvas();
      sampleCanvas.setHeight("95%");
      sampleCanvas.setWidth("100%");
      sampleCanvas.addChild(sampleGrid);
      layout.addMember(sampleCanvas);
      }
      DataSource code(RestDataSource)
      Transform Request
      protected Object transformRequest(DSRequest dsRequest) {
      if (dsRequest != null) {
      try {
      int startIndex = dsRequest.getStartRow();
      int endIndex = dsRequest.getEndRow();
      int count = endIndex - startIndex;
      if (count > 30) {
      count = 30;
      }
      } catch (Exception exception) {
      exception.printStackTrace();
      }
      }

      Transform Response (JSON Response)
      protected void transformResponse(DSResponse response, DSRequest request, Object data) {
      if (request.getOperationType().equals(DSOperationType.FETCH)) {
      JavaScriptObject responseJavaScriptObject = (JavaScriptObject) data;
      Integer totalOperLogs = JSOHelper.getAttributeAsInt(responseJavaScriptObject, "totalCount"); //server will return the total records available in DB

      response.setTotalRows(totalOperLogs);
      }
      }

      Sample Request as below:

      If DB is having more than 30 records, UI can send request as mentioned below.
      request-1
      {
      .......................
      "startIndex":0,
      "count":30,
      …………..
      }
      request-2(After scroll down)
      {
      ..........................
      "startIndex":30,
      "count":30,
      …………..
      }
      ....................

      Issue: ListGrid is not able to initiate next request while scrolling down ( If DB is having data in between 30 - 40 )
      Resolution: 1280 X 1024 and 1280 X 960

      Note : some resolutions Pagination is working fine.

      Please find the attached server response format.

      Thank you,

      Attached Files

      Comment


        #4
        It looks like you are trying to manipulate the startRow and endRow in transformRequest(), but this is invalid. If the grid has requested a given range of rows, you need to provide that range of rows. If you want to cause less rows to be requested, you can use settings like dataPageSize, drawAheadRatio and drawAllMaxCells to adjust how far ahead of the viewport the grid fetches.

        The other problem here is that we see now code for setting the startRow and endRow on the DSResponse. This is also required.

        Comment

        Working...
        X