Search code examples
datagriddatasourcefilteringfuelux

Custom data filter on FuelUX datagrid not updating data display with results


I am trying to implement a filter on my custom datasource for a FuelUX datagrid.

It filters the data properly but leaves it paginated as though it was not filtered. I.E. I have to either increase the results per page or go to the next page to see the results.

How do I get the grid to update to display the filtered results properly?

Here is my custom filter function:

            if (options.filter) {                   
                data = data.filter(function (item) {
                    switch( options.filter.value )
                    {
                        case "all":
                            return true;
                        break;

                        default:
                            return item.contentID == options.filter.value;
                        break;
                    }
                });
            }

Solution

  • Good catch! I have entered an issue for this at https://github.com/ExactTarget/fuelux/issues/143

    In the meantime, just add this logic after you load Fuel UX but before you initialize your datagrid.

    $.fn.datagrid.Constructor.prototype.filterChanged = function (e, filter) {
        this.options.dataOptions.filter = filter;
        this.options.dataOptions.pageIndex = 0;
        this.renderData();
    };
    

    Thank you for the report.