[Data Grid] Manipulate Column filters externally

Forge Component
Published on 12 Feb (11 days ago) by OutSystems R&D
34 votes
Published on 12 Feb (11 days ago) by OutSystems R&D

Just wanted to check if anyone has implemented anything around manipulating the Column filters externally. 

Say if we have a grid , a text box above it and a button to filter records as below.

If I go and enter a comma separated string in the text box and click filter it should filter the records in the grid and check the respective filter criteria. Something like below.

Note :  I don't want to refresh the data set by going for a API call. Want to implement this to be refreshed just at client side. 

Any leads would be appreciated. 



I am doing something similar via an extened property on an OS Widget.

    property:  onclick()

    value:  Fiter.a(osGridObject.Id)

Where Filter is a javascript method in my javascript library.

Filter = (function () {

    'use strict';
    var _a = "A";    var _b= "B";    var _c= "C";
    function _filterPermissions(gridRunTimeId, filterTerm) {

        var theGridObj = GridOS.ComponentUtils.getGridObjectById(gridRunTimeId);
        theGridObj.grid.collectionView.filter = function (item) {

            return filterTerm.length == 0 || item.column["yourColumnName"].indexOf(filterTerm) > -1;        };

    return {        

        a\: function (gridRunTimeId) {            _filterPermissions(gridRunTimeId, _a);        },

        b\: function (gridRunTimeId) {            _filterPermissions(gridRunTimeId, _b);        },
        c\: function (gridRunTimeId) {            _filterPermissions(gridRunTimeId, _c);        }