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

  • ListGrid.refreshData () sorting problem

    SmartGWT Version: 6.0-p20171125
    Chrome: 62.0.3202.94

    The ListGrid.refreshData () method discards the sort. The header shows the correct sorting status but the sorting of the data returns to the initial value.
    This happens only if we use a datasource with dataUrl. A SQL Datasource does not have this behavior. The ListGrid has dataFetchMode = local.

    At the moment we manage this issue with the following workaround:

    selectedState = listGrid.getSortState();

    listGrid.refreshData((dsResponse, data, dsRequest) -> {

    What are we doing wrong?

  • #2
    You can try calling refreshData() using various samples and you will see that the sort direction is not discarded.

    You say that this only happens with a DataSource with a dataURL, but refreshData() is a ListGrid behavior that has no knowledge of the implementation of your DataSource, so this actually suggests that your DataSource is misbehaving in some way; perhaps it is ignoring the requested sort.

    Whatever the cause, we will need a minimal, ready-to-run test case reproducing the problem in order to investigate.


    • #3
      Yes you are right, our server side implementation is wrong, because we did not implement the sorting.
      But the problem is that in the HTTP request we get no further parameters except the Criteria meta data.
      But we need also the "_sortBy" meta data. So we have no way to evaluate the sort configuration on server side.

      In the attachments you can see our ListGrid with a sorting configuration on the field "IP Address". If I execute the ListGrid.refreshData() methode I get the following HTTPRequest (with the filter criteria but without the sortBy parameter). Attached is also my datasource configuration.
      Attached Files


      • #4
        See QuickStart Guide, Data Integration chapter. If you want a DataSource that has a complete protocol for sending all aspects of the request - not just sortBy but also things like startRow/endRow, operationType, operationId, etc - use RestDataSource.

        Otherwise if you want to invent your own protocol, you would start with DataSource as you have, but you would then decide how to send all the metadata (like sortBy) yourself, using transformRequest / transformResponse. The default is to send *just* the, in this case, that's just the criteria.


        • #5
          Thanks for the tip! It works!