Using promises with server-side FlexGridFilter

Posted by: matthew.hudson on 3 October 2017, 7:48 am EST

    • Post Options:
    • Link

    Posted 3 October 2017, 7:48 am EST

    Hi,

    I’m working in AngularJS to integrate Flexgrid with a non-OData Java API such that sorting, filtering, and pagination are functional. As part of this I want the unique values in the value filter to reflect the values across all pages rather than the current page and have achieved this by populating the value filter’s unique value field during the getColumnFilter callback.

    My issue is that the getColumnFilter callback will cause the value filter to show a blank list if I return a deferred promise. I’ve worked around this by returning a reference to the object which I modify once the promise resolves, but in some cases, a user could open the filter prior to the promise resolving and see invalid data in the filter at which point the shown data would not update until the filter was reopened. Is there a safe way to handle asynchronously loading the unique values into a FlexGridFilter’s value filter when a user opens the filter?

    Thank you,

    Matthew

  • Posted 3 October 2017, 10:52 pm EST

    Hi,

    The filter should show unique values for the current page until uniqueValues are not set. Since you are getting unique values from API, it will definitely take time to fetch records.

    Hence, here are some suggestions for you given below:

    You can prevent opening filter by canceling filterChanging event for FlexGridFilter by setting cancel to true.

    You can show loading in filter dialog by manipulating through DOM and reopen filter after assigning fetched unique records to uniqueValues property.

    Thanks,

    Manish Kumar Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels