I got 2 cols named ‘positions’ and ‘notional_value’. I want the number under ‘notional_value’ start with a dollar sign, the rest leaves unchanged.
columns[i].format = function(value){
return (what condition expression) ? “$” + value : value;
}
Thank you!
on:{
onHeaderInit: function(columns){
for(var i=0; i< columns.length;i++){
if(columns[i].id == "your_column_id")
columns[i].format = function(value) {
return "$"+value;
}
}
}
}
Thanks I got your idea, but I was using the pivot table, there are 3 variables in my column. I applied your code, but it doesn’t work in my project.
I assume using ‘var header = columns[i][“header”];‘ first,
then header.id == “my_column_id”, or header[1].id == “my_column_id”
yet they don’t work either.
ID of each column is based on its data: columns/values names and type of the current data operation. For example:
id: "2005_'_max_'_oil" //column_'_operation_'_value
So if you want to apply your own template, you need to use the substring comparison:
http://webix.com/snippet/da3f91a4
Oh that looks even greater than i expected, thank you!
ps: if I only want to match all the oil columns, just use Regex like
http://webix.com/snippet/3a41b920
That’s fun!