Our blazing fast Grid component built with pure JavaScript


Post by janan »

We use the coulmn.filter function in the following way.

column.filterable = function(data) {
    var value     = data.value,
        property  = data.property,
        record    = data.record,
        colData   = record[property]};

In the version 4.0.4, we are not able to access 'property' which we could access in previous version. Is there any alternative to access the 'property'


Post by alex.l »

Hi Janan,

There is no way to get that value from the scope of this function now. I've created a ticket to move it back: https://github.com/bryntum/support/issues/2120

All the best,
Alex

All the best,
Alex


Post by janan »

Hi,
How can we access the column name?Is there any work around for it?


Post by saki »

I can only think of a very dirty hack so if you decide to use it, do not forget to remove it after the above ticket will be fixed. It could go as follows:

columns : [
    {
        text       : 'Name (custom filter: whole words)',
        field      : 'name',
        flex       : 1,
        // This column has a custom filtering function that matches whole words
        filterable : function(context) {
            const { record, value } = context;
            console.log(this.property);
            return Boolean(record.name.match(new RegExp(`${StringHelper.escapeRegExp(value)}\\b`, 'i')));
        }.bind({ property : 'name' })
    },

Post Reply