jQuery UI Widgets Forums Navigation Tree DropDown Tree using JSON as data

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 6 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • DropDown Tree using JSON as data #90594


    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 = {
                  datafields : [{name:"id", type:"int"} , {name:"ParentId", type:"int"} , {name:"Title", type:"string"}],
                var dataAdapter = new.$.jqx.dataAdapter(source);
                var records = dataAdapter.getRecordsHierarchy("id" , "ParentId" , "items" , [{name:"Title" , "map:"label"}]);
                $("#jqxTree").jqxTree({ source:records, width: 200, height: 220});
    DropDown Tree using JSON as data #90731


    Hello AliMajed,

    Please refer to the following example: http://jsfiddle.net/v9fzp00t/ (it does not matter what type the source of the jqxTree is). We hope it is helpful to you.

    Best Regards,

    jQWidgets team

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.