Announcement

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

    ListGrid -> Criteria -> Force server fetch

    Dear SmartGWT users,
    I would like to discuss my solution.

    I have ListGrid, this list grid should contain data according to the user needs. Simple filter UI was created. Every time user press Filter button, Filter button should be disabled, Criteria should be created, fetch server data operation should occur and finally Filter button should be enabled. My code looks like this:

    Code:
    btnFilter.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            btnFilter.setDisabled(true);
    
            lgOperations.invalidateCache();
            lgOperations.fetchData(new Criteria("foo", (String) tiFoo.getValue()), new DSCallback() {
                public void execute(DSResponse response, Object rawData, DSRequest request) {
                    btnFilter.setDisabled(false);
                }
            });
        }
    });
    Is there better alternative for this code?

    In the docs I read about com.smartgwt.client.data.ResultSet but this class is not included in the SmartGWT 1.0b2.

    Best regards,

    Ales

    #2
    Solution looks fine, however, what problem were you solving? :)

    You are forcing the cache to be invalidated. The only reason you would want/need to do this is if you wanted to ensure that client-side filtering is never used.

    Comment


      #3
      Thanks for your reply. I want to force server fetch, ensure data are loaded from server according to the provided criteria. After pressing Filter button server round trip must occur.

      Best regards,

      Ales

      Comment

      Working...
      X