Announcement

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

    How to cancel ListGrid.fetchData() or ListGrid.filterData() request

    SmartGWT: pro-3.0p
    Internet Explorer: 8.0

    Is there a way to cancel a fetch/filter request from a listgrid if the server is taking a long time to return? I realized there is timeout I can set per request but what I want is for the user to be able to cancel the request with a click of a button.

    #2
    When you say "Cancel" the request, what exactly do you mean?

    Are you
    a) Looking for a way to stop the client from reacting to the request? As a concrete example -- the user hits "fetch" on a ListGrid and a fetch is initialized. The server takes a long time to respond and the user wants to "cancel the fetch" so the ListGrid goes back to being empty rather than showing a "loading" message and the user can continue using the app / potentially kick off a different fetch, etc

    Or, b) Looking for a way to cancel or reverse the processing on the server? As a concrete example -- the user edits a record in a DynamicForm and hits "Save". Then they change their mind and want to prevent the save from occurring.

    We can recommend how best to achieve this but it would help to have a clear picture of what behavior you're actually looking for

    Thanks
    Isomorphic Software

    Comment


      #3
      Originally posted by Isomorphic View Post
      When you say "Cancel" the request, what exactly do you mean?

      Are you
      a) Looking for a way to stop the client from reacting to the request? As a concrete example -- the user hits "fetch" on a ListGrid and a fetch is initialized. The server takes a long time to respond and the user wants to "cancel the fetch" so the ListGrid goes back to being empty rather than showing a "loading" message and the user can continue using the app / potentially kick off a different fetch, etc
      Yes. This is exactly what I'm looking for. How can I do this? Any suggestions would be appreciated.
      Last edited by dbaluyot; 4 Oct 2012, 09:47. Reason: asking for more suggestions.

      Comment


        #4
        anyone else has suggestion

        Anyone else has suggestion how to accomplish this?

        Comment


          #5
          For the case of a simple fetch, you could just call "setData([])" on the grid.
          This would cause the resultSet created by the grid to be essentially discarded. The grid would show empty data as if the fetch had never been initialized.
          When the server finally does respond to the request, it would have no visible effect, since it would be updating a ResultSet that is not actually being displayed within any components.

          This may be sufficient for your application. However there are more complex possible interactions here which would not be so simple to catch. For example if the user sorts a grid with a partially loaded dataSet, this would kick off a fetch to the server (since the sort would have to be achieved server-side). "Canceling" that fetch would be more difficult as you would have to reinstate the existing set of data and disable the sort UI notifications, etc. Similarly with a change of filter criteria, etc.

          Note - If you want a fuller solution built into the framework, this is a feature that would be eligible for feature sponsorship. If this would be of interest, please let us know.

          What we'd propose would be essentially a flag to show a "Cancel" option in the prompt for operations, which, if clicked would cause the application to cleanly reset all pending state (refreshing components to their previous state, as if the request had not been issued, etc).

          Regards
          Isomorphic Software

          Comment

          Working...
          X