Hello, does the panel component have a click event?
Hello @JACK_CHYMBCC ,
Panel
doesn’t support such event as onClick
, but you can use native html events.
Please check the sample: https://snippet.webix.com/v4mu0978
Hello, but with the click event, the same component ID will pop up every time you click.
This is my code:
var uiArray = new Array();
var grid = {
view:"dashboard", id:"grid",
gridColumns:4, gridRows:4,
cellHeight: 200,
factory:function(obj){
obj.view = "panel";
obj.resize = true;
obj.body = { template: $$("list").getItem(obj.name).value };
uiArray.push(obj.id);
/*Uncaught TypeError: Cannot read property '$view' of undefined
at line 8*/
return obj;
},
on:{
onChange:function(){
var state = this.serialize();
webix.storage.local.put("grid-dashboard-state", state);
}
}
};
var widgets = {
rows:[{
type:"header",
template:"Widgets, drag from here",
},{
view:"list", id:"list",
width:200,
drag:"source",
template:"#value# - (#dx#x#dy#)",
data:[
{ id:"a", value:"Widget A", dx:1, dy:1 },
{ id:"b", value:"Widget B", dx:1, dy:2 },
{ id:"c", value:"Widget C", dx:2, dy:1 },
{ id:"d", value:"Widget D", dx:2, dy:2 },
{ id:"e", value:"Widget E", dx:1, dy:1 },
{ id:"f", value:"Widget F", dx:1, dy:1 },
{ id:"g", value:"Widget G", dx:3, dy:1 }
]
},{
view:"button", value:"Reset", click:function(){
$$("grid").clearAll();
}
}]
};
webix.ui({
type:"space", cols:[
{ view:"scrollview", body:grid },
widgets
]
});
var state = webix.storage.local.get("grid-dashboard-state");
if (state)
$$("grid").restore(state);
for(var ui in uiArray){
webix.event($$(uiArray[ui]).$view, "click", function(e){
alert(uiArray[ui])
});
}
function do_something(){
webix.message("Click on the panel");
}
Hello, Anna zankevich, how can I get here @ you.This is my first time to use the community @ alone, please forgive me
In this case, try to attach global onClick
event:
webix.attachEvent("onClick", function(e){
// logic
});
Please, check the following snippet: https://snippet.webix.com/4oyi6y0q
That’s a great help. Thank you very much