type

used for configuring presentation of items

object type;

Example

//colors titles of odd rows in red, even - in green
grid = webix.ui({
    view:"datatable",
    id:"table1",
    type:{
        title_color:function(obj,type){
            var odd = $$("table1").getIndexById(obj.id)%2
            return odd?"red":"green"
        }
    },
    columns:[
        { id:"title", header:"Film title", 
        template:"<span style='color:{common.title_color()}'>#title#</span>"}
    ],
    ...
});

Details

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]}.

grid = webix.ui({
    view:"datatable",
    id:"table1",
    type:{
        title_color:function(obj,type){
            var odd = $$("table1").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>"}}
    ]
});
See also
Back to top
Join Our Forum
We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.
If you have not checked yet, be sure to visit site of our main product Webix web development library and page of tree table widget product.