FlexGridFilter and async data load

Posted by: sicrum on 18 October 2018, 4:17 am EST

    • Post Options:
    • Link

    Posted 18 October 2018, 4:17 am EST

    Hello

    We have a angular2 FlexGrid that loads paged data asynchronously.

    So, we have API method on the server, that accepts page size, page number, column filters, sorting, etc. This method returns only required page data.

    FlexGridFilter uses only data loaded into the FlexGrid. But since in our grid we have only single data page - FlexGridFilter doesn’t show all required values.

    So, question.

    Is it possible to customize FlexGridFilter to make these possible:

    • Populate filter values from the server (not only those that exist in current page)
    • Disable default filtering and send filters description to the server when filter has been edited.
  • Posted 22 October 2018, 12:11 am EST

    any thoughts from dev team?

  • Posted 22 October 2018, 2:19 am EST

    • Populate filter values from the server (not only those that exist in current page)

      <<<<<<<<<<

      You may customize the values shown in FlexGridFilter by using uniqueValues property of ValueFilter

      let colFilter = filter.getColumnFIlter('country);

      colFilter.valueFilter.uniqueValues = [‘a’, ‘b’];

      You may also refer to the following sample: https://stackblitz.com/edit/angular-yao4h6?file=app%2Fapp.component.ts

    ~Sharad

  • Posted 22 October 2018, 5:27 am EST

    thanks!

  • Posted 30 October 2018, 6:35 am EST

    I have another related question, take a look at:

    https://stackblitz.com/edit/angular-ak2gxw?file=app%2Fapp.component.html

    Assume that I have Id/Name entity that I want to be filtered.

    So, with server side filtering I’d like to see Name in filter but receive Id on the server side.

    Ok, I use uniqueValues and dataMap properties.

    Based on API reference:

    DataMap — Gets or sets the DataMap used to convert raw values into display values shown when editing this filter.

    So, I expect that in UI raw ID fields should be converted to Name fields using datamap.

    But there are still 1,2,3 when I click on filter icon

  • Posted 31 October 2018, 8:09 am EST

    Hi,

    For this, you need to map with the name instead of id. Please refer to the following sample:

    https://stackblitz.com/edit/angular-e32fwx?file=app%2Fapp.component.ts

    Code snippet:

    columnFilter.valueFilter.uniqueValues = this.customData.map(d => d.name);
          columnFilter.valueFilter.dataMap = this.customDataMap;
    

    ~Manish

Need extra support?

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

Learn More

Forum Channels