Search code examples
javascriptbitrix

Bitrix24 injecting filter values with BX.Main.filterManager


I'm trying to change a Bitrix grid filter with javascript. I can access the filter with BX.Main.filterManager.getById("GRID_ID"), can refresh the filter and the connected grid with .applyFilter() but I couldn't find a way to change them.

How can I get the current filters and add or remove any filters to that list?


Solution

  •     var filter = BX.Main.filterManager.getById(BX.Tasks.GridActions.gridId);
        var values = filter.getFilterFieldsValues();
    
        // .. modify values as you wish .. 
    
        filter.getApi().setFields(values);
        filter.getApi().apply();