Datatable filter: filter on hidden row and also header filter

Hello,

I want from a button hide/show the ranking > 5 (hidden column) and also use filter in header.
I have implemented a little example that filter ranking > 5 when I click on a button but I don't know how to implement to apply a AND between this filter and the others.
http://webix.com/snippet/8dfb41a1

Regards

Tagged:

Comments

  • You can use .registerFilter API to register some filter to work along with build in filters.

    http://webix.com/snippet/669ef55e

  • Thanks.
    That working well.

  • @Maksim - how to register a filter which is not based on any column? I need to get a whole row (and not just one column value) in a filter function.

  • Hello Maug,

    I have the same issue. That can be nice if we can get whole row.
    The workaround is to create a column with all field value concatenate with separator (if the rule is simple you can register multiple filter).

    Regards,

    Eric.

  • datatable has dedicated method filter https://docs.webix.com/api__link__ui.datatable_filter.html
    you just need to get a value from an input and filter datatable

    var value = filterInput.getValue().toUpperCase();
    table.filter(function(row){
        for(var prop in row) {
            var propValue = row[prop];
            if (propValue != null){
                propValue = propValue.toString().toUpperCase();
                if (propValue.indexOf(value) > -1) return true;
            }
        }
        return false;
    });
    
  • @EricR thanks for the workaround, in my case each row is complex and big object so copying it to itself is not very good idea.
    @intregal I know about filter() method, what I'm looking for is way to register the filter using registerFilter() for it to be used along with the standard filters (ie. the method filterByAll()

  • @maug
    Another method I have made but only available if data is not modified, is to put the row content in the attribut of the row and use this attribut as filter.
    row["myRow"] = row;

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!