Hi,
I think is a very good idea to provide a dhtmlx library for touch terminals.
I’m making some tests trying to load a toolbar and a popup menu.
Is it possible to load a popup menu not from xml ?
Hi,
I think is a very good idea to provide a dhtmlx library for touch terminals.
I’m making some tests trying to load a toolbar and a popup menu.
Is it possible to load a popup menu not from xml ?
Yep, it can be loaded through xml or json ( technically it can be loaded from jsarray, or csv, but it is not very usefull )
Default code in sample is
{
view:"list",
url:"menu.xml", datatype:"xml",
select:true, y_count:3
}
to load from external json file
{
view:"list",
url:"menu.json", datatype:"json",
select:true, y_count:3
}
or you can include the list of options directly in config as
{
view:"list",
data:[ { id:"1", text:"item 1"},{ id:"2", text:"item 2"},{ id:"3", text:"item 3"} ],
select:true, y_count:3
}
Same can be used for toolbars, forms, lists.
thanks, i try
I’ve a problem:
Following script works (like in samples)
dhx.ui({
view:“popup”,
id:“Menu_W1”,
body:{
view:“list”,
url:“menu1.xml”, datatype:“xml”,
select:true, y_count:3
}
}).hide();
Instead following script does not show the text label on the popup menu. I see only 3 blank rows.
dhx.ui({
view:“popup”,
id:“Menu_W1”,
body:{
view:“list”,
data:[ { id:“1”, text:“item 1”},{ id:“2”, text:“item 2”},{ id:“3”, text:“item 3”}} ],
select:true, y_count:3
}
}).hide();
Have you got any idea ?
Sorry for inconvenience, change the format of json as
data:[
{ id:"1", value:"item 1"},{ id:"2", value:"item 2"},{ id:"3", value:"item 3"}
],
You can configure list to use any properties of json object as part of label, but by default it uses obj.value ( which, in case of xml is content of related tag )
OK, it works.
But i’ve another question
How can i attacch events to items ?
I look the examples but the event is attached to the list,
I tried to attach it to the items $$“id” but seems not work
You can’t attach event directly to the item ( list-item is not a first class object )
$$('Menu_W1').attachEvent("onItemClick", function(id){
if (id == "1") do_something();
});
Is there any special reason, why code as above one can’t be used instead of direct event attaching ?
Well, i’m doing some tests to understand the correct/best way to use this library.
Actually i’m trying to do an XSL server side trasformation to be able to configure on an XML file the complete toolbar with the sub-menus (popup list view) and following actions.
If you’re interested, once finished, i could send to you the solution.
My code is now as follow, but it doesn’t catch the event onItemClick
dhx.ui({
rows:[
{
template:‘
Test
dhx.ui({
view:“popup”,
id:“Menu_W1”,
body:{
view:“list”,
id:“List_W1”,
data:[
{ id:“Item_W1A1”, value:“Solutions”},
{ id:“Item_W1A2”, value:“Collaboration”},
{ id:“Item_W1A3”, value:“Idea”},
],
select:true,
y_count:3,
type: { width: 200 }
}
}).hide();
$$(“Menu_W1”).attachEvent(“onItemClick”, function(){
dhx.alert(“items clicked:”+ id);
});
While it may be a bit less beautiful the above approach can be used for your use-case as well.
You can have multiple onItemClick handlers in the same time ( they all will be processed for each click ) - so you can generate the new event handler for each list item
If you’re interested, once finished, i could send to you the solution.
Yep, it will be interesting.
My code is now as follow, but it doesn’t catch the event onItemClick
My bad, change
$(“Menu_W1”) with $(“List_W1”)
I am also experiencing the same problem.
Any feedback would be appreciated