Documentation

onClick

attaches a click behavior for component items with the specified CSS class.

hash onClick;

See also

Details
  • "onClick" behavior is defined for component items rather than for the whole component
  • Use the 'onItemClick' handler to attach function to item clicking regardless of the CSS class;
  • For standard Webix buttons you'd better use the click property to attach a function;
  • on_click handler can override the default onclick event:
 
grid = new webix.ui({
view:"datatable",
columns:[
        { id:"rank",    header:"", css:"rank",          width:50},
        { id:"title",   header:"Film title",width:200},
        {   id:"", template:"<input class='delbtn' type='button' value='Delete'>",  
            css:"padding_less",width:100 }],        
on:{
    "onItemClick":function(id, e, trg){ 
        webix.message("Click on row: " + id.row+", column: " + id.column);}
    } //default click behavior that is true for any datatable cell
},
// click behavior for the cell with a button styled with 'delbtn' class
onClick:{ 
    "delbtn":function(e, id, trg){
        webix.message("Delete row: "+id); 
        return false; //here it blocks default behavior
    }
});
Back to top