ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started 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;
}
}
-
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.
-
Has this functionality been added?
-
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.
-
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.
-
ETA is by end of the current month.
-
It's been added in v3.0.0