Hello
Before I create this topic, I have red the other topics that might solve my problem, but they did NOT.
I have a DropDown Tree that gets it’s data from JSON. It works almost fine, but with 2 problem:
1) I need to have a “placeholder” in my “dropdownButton”, but there is No such attribute.
2) I want that when select an item, it show the name(label) of the item instead of the id.
here is my code:
function success (response) {
$("#dropDownButton").jqxDropDownButton({ width: 150, height: 25, rtl:true});
$('#jqxTree').on('select', function (event) {
var args = event.args;
var item = $('#jqxTree').jqxTree('getItem', args.element);
var dropDownContent = '<div style="position: relative; margin-left: 3px; margin-top: 5px;">' + item.label + '</div>';
$("#dropDownButton").jqxDropDownButton('setContent', dropDownContent);
});
var source = {
datatype:"json",
datafields : [{name:"id", type:"int"} , {name:"ParentId", type:"int"} , {name:"Title", type:"string"}],
id:"id",
localdata:response
};
var dataAdapter = new.$.jqx.dataAdapter(source);
dataAdapter.dataBind();
var records = dataAdapter.getRecordsHierarchy("id" , "ParentId" , "items" , [{name:"Title" , "map:"label"}]);
$("#jqxTree").jqxTree({ source:records, width: 200, height: 220});
});