1

i'm developing a mobile WebApp using DHTMLx touch.

i have created combo control using DHTMLx Touch.

i need to add items for this control dynamically.

there are samples explaining how to populate the control using JSON or XML.

But i need to populate in runtime.

i'm open to approach other than loading from JSON/XML

Thanks in advance.

siva
  • 1,429
  • 3
  • 26
  • 47

2 Answers2

0

I know this is an old question, but I had a hard time finding a proper solution (even now). I'm posting this just in case anyone else is interested.

Okay, so to dynamically populate a DHTMLX Touch Combobox simply include the "datatype" and "url" properties in your combobox definition. Note: these properties do not appear to be included in the official DHTMLX Touch documentation.

Your comobox definition should look something like this:

{ view: 'combobox', label: 'Your Label:', id: 'Your ID', datatype: 'json', url: 'YourSourceFile.php' }

And your source file should output a valid json format that includes a value and an id, for example:

[
    { "value":"My first value", "id":"1" },
    { "value":"My second value", "id":"2" },
    { "value":"My third value", "id":"3" }
]

That's it!

0

i couldn't find the correct solution.

One Tweak solution is to use a template and create a HTML ccombo box

<head>
<script type="text/javascript">
function drawCombobox()
{
  document.getElementByID("comboZone").innerHTML = '<select class= "combostyle"><options...></select>
}
</script>
</head>
<body>
<script>
...
<view:'template',template:'<div id="comboZone"></div>'
</script
siva
  • 1,429
  • 3
  • 26
  • 47