Announcement

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

    Catching the initial fetch

    Hi
    Please, can you explain following situation?

    I have Listrgrid with overridden all fetchData(), all filterData() and getInitialCriteria() methods. Inside these overridden methods are just some outputs to the console.
    The listgrid has set some initialCriteria and autoFetchData to true.

    What I was expecting is, that I’ll see logs of the initial fetch, but the console stays empty.
    After setting autoFetchAsFilter to true, nothing has changed.
    Calling directly fetchData() from button handler is printing logs properly.

    Basically what I need to do is to enhance criteria for every listgrid fetch, including the initial one.
    Please see modified GridDataBoundFetchSample from v8.3p_2013-11-13/LGPL Development Only (built 2013-11-13).

    Thanks
    Attached Files

    #2
    Basically the initial auto-fetch doesn't directly call the Java fetchData or filterData methods so overriding these will have no effect.
    getInitialCriteria isn't set up as a SmartGWT override point, meaning that when the JavaScript logic runs to perform the initial fetch (and pick up the initial criteria) it doesn't call the Java version of this method.
    You can think of it instead as a simple accessor allowing developers to look at the initial criteria for the grid.

    You could solve this in a few ways: One option would be to have autoFetchData set to false, and simply add a drawHandler to your ListGrid which explicitly calls fetchData or filterData with the criteria you want to apply.
    Another option would be to customize the request further downstream - for example via transformRequest on the DataSource

    Regards
    Isomorphic Software

    Comment

    Working...
    X