Skip to content

type

used for configuring presentation of items

let type: WebixDatatableType
const grid = webix.grid({
id:"grid1",
type:{
title_color:function(obj,type){
var odd = grid.getIndexById(obj.id)%2
return odd?"red":"green"
}
},
columns:[
{ id:"title", header:"Film title",
template:"<span style='color:{common.title_color()}'>#title#</span>"}
],
...
});

The parameter is intended for defining the functions that can be afterwards used while setting the template for a column.

In the template the defined function can be accessed through {common.[func_name]}.

const grid = webix.grid({
id:"grid1",
type:{
title_color:function(obj,type){
var odd = grid.getIndexById(obj.id)%2
return odd?"red":"green"
},
votes_color:function(obj,type){
return (obj.votes > 350000?"green":"red")
}
},
columns:[
{ id:"title", header:"Film title",
template:"<span style='color:{common.title_color()}'>#title#</span>"},
{ id:"votes", header:"Votes",
template:function(obj,type){return "<span style='color:"+type.votes_color(obj)+
"'>"+obj.votes+"</span>"}}
]
});