Hi,
I have the following snippet of code and would like to be able to fetch the data fetch server-side data based on the selection in the combo.
So far this works and gets the data from the server but I can’t figure out how to update this data to the tree menu.
<script type="text/javascript" charset="utf-8">
var combo = webix.ui({
container: 'combo_menu',
view: "combo",
label: "Unit",
labelPosition: "top",
labelAlign: 'left',
placeholder: "Select Unit",
id: "bu_select",
options: "rest->/units.json",
button: true
});
var tree = webix.ui({
container: "tree_menu",
view: "tree",
id: "treeMenu",
select: true,
height: 500,
data: []
});
webix.ready(function () {
webix.ui({
combo,
tree
});
});
$$("bu_select").attachEvent("onChange", function (sel, oldv) {
webix.message("Value changed from: " + oldv + " to: " + sel);
$.ajax({
url: "tree_data",
type: "GET",
dataType: 'script',
data: {bu_id: sel},
success: function (data) {
webix.message(data);
$$("treeMenu").updateItem(data)
}
});
});
</script>
This does not work.
$$("treeMenu").updateItem(data)
Any help is appreciated.