SlickGrid filtering...

501 views
Skip to first unread message

Rimantas Usevicius

unread,
May 24, 2013, 1:23:56 PM5/24/13
to slic...@googlegroups.com
Hi,

Perhaps I'm newbie and with JavaScript , please help , how to improve filtering options with SlickGrid . I did something similar like "example-header-row.html" . Here is filtering function :

function filter(item) {
    for (var columnId in columnFilters) {
      if (columnId !== undefined && columnFilters[columnId] !== "") {
        var c = grid.getColumns()[grid.getColumnIndex(columnId)];
        if (item[c.field] != columnFilters[columnId]) {
          return false;
        }
      }
    }
    return true;
  }

What I want - for char columns to do filtering as substring alreday . But I don't know how to compare items column object ... :( . I tried that :

        if ( item[c.field].substring(  columnFilters[columnId].trim().length ) != columnFilters[columnId].trim() )
           return false;

But that isn't working ...

Thanks in advance !

Rimantas Usevicius

unread,
May 25, 2013, 1:15:03 PM5/25/13
to slic...@googlegroups.com
   Hi !

   After some search found solution for that . Now I have another question . I want to extend this filtering possibility and to do unique own one function for that . Ussually data are chars, dates, booleans and nums. What I missed in Slickgrid - which type of data is used in column ? Maybe it alreday exist, but after reviewing sources I didn't found ... If that exist - can you direct me to true path ?  Slick.Editors type ? For nums types I want to improve filters with <,> and other numeric operands symbols , the same can be done and with dates types . At this time I can do that only with field ID - recognizing of that I can say what type of column it's . But this solution ins't clear - better it will be if detect column type from grid .

  Many thanks in advance and any help ! 
Reply all
Reply to author
Forward
Message has been deleted
0 new messages