I'm using dropdown and it's items are as a treeview. When i selected item on treeview , it shows value instead text in dropdown. What's wrong with it ?
function open() {
if (!isDropDownFilled) {
isDropDownFilled = true;
$.ajax({
type: "GET",
url: "@Url.Action("FillDropDownWithCategories", "Category")", // <-- Where should this point?
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var treeObj;
var dropdownObj = document.getElementById("categoryDropdown").ej2_instances[0];
dropdownObj.popupObj.element.firstElementChild.className = "e-content overflow";
// rendering the treeview only on first time
if (treeObj == null || treeObj == undefined) {
debugger;
treeObj = new ej.navigations.TreeView({
fields: {
dataSource: response.result,
id: 'id',
parentID: 'parentId',
text: 'categoryName',
hasChildren: 'hasChild'
},
// use the nodeselected event to add the text to dropdown's input element.
nodeSelected: function (args) {
dropdownObj.inputElement.text = args.nodeData.text;
dropdownObj.inputElement.value = args.nodeData.id;
}
});
debugger;
treeObj.appendTo('#tree');
}
}
});
}
}