ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: webifi on February 05, 2015, 08:10:05 pm

Title: class/style of row based on row data
Post by: webifi on February 05, 2015, 08:10:05 pm
There doesn't appear to be a rowInit event.

Id like an easy way to set the class/style of a row without having to re-iterate the grid rows after they are rendered, or without injecting data into the data array before rendering the grid.

Does something like this exist?

rowInit: function(ui){
    var $tr = ui.$tr, rowData = ui.rowData;
    if(rowData.days_past_due >= rowData.terms){
        $tr.addClass('past-due');
    }
}

Or, something like this?

rowModel: {
    init: function(ui){
    }
    cls: function(rowData,rowIndx){
        return rowData.my_index>0?'my-class':null;
    }
    style: function(rowData,rowIndx){
        return rowData.my_index>0?'background-color:red':null;
    }
}
Title: Re: class/style of row based on row data
Post by: paramvir on February 06, 2015, 01:02:46 am
Thanks for nice suggestion, consider it ( or some kind of its variant ) done in one of the next versions.

Currently the optimum way to change class/style/data of row /cell based on row data/ any other condition is to do it in JSON data itself while loading data into the grid.

If the row data/ condition changes during runtime e.g., by editing or copy/paste then listening to change event is required.
Title: Re: class/style of row based on row data
Post by: webifi on April 08, 2015, 09:40:03 pm
Has this functionality been added?
Title: Re: class/style of row based on row data
Post by: paramvir on April 08, 2015, 10:03:54 pm
rowInit or its variant would be added for convenience in next version.

However if you face any problem in adding row class/style based on row data with current API, please let's know.
Title: Re: class/style of row based on row data
Post by: webifi on April 08, 2015, 10:18:21 pm
Roughly how long until a version will be out with this?  The current method of either injecting data into JSON  or iterating and adding classes to the rows after rendering is not ideal.
Title: Re: class/style of row based on row data
Post by: paramvir on April 08, 2015, 11:17:45 pm
ETA is by end of the current month.
Title: Re: class/style of row based on row data
Post by: paramvir on July 09, 2015, 06:12:45 pm
It's been added in v3.0.0