jQWidgets Forums
jQuery UI Widgets › Forums › Plugins › Data Adapter › adapter and menu problem with JSON
This topic contains 1 reply, has 2 voices, and was last updated by Martin 6 years, 8 months ago.
-
Author
-
Hi, my problem is, my menu show only data parentid -1 and not show parent-child.
This is my code…
$('#MainWindow').jqxWindow({ autoOpen: false, isModal: true, width: "100%", height: "100%", draggable: false, resizable: false, theme: theme, initContent: function () { var data = $.fn.fQuery2JSon("db-php/","main-menu.php",LevelUser.toString().trim()); var menuData = { datatype: "json", datafields: [ { name: 'id', type: 'int' }, { name: 'text', type: 'string' }, { name: 'parentid', type: 'int' }, { name: 'subMenuWidth', type: 'string' }, { name: 'level', type: 'int' } ], id: 'id', localdata: data }; var DatMenu = new $.jqx.dataAdapter(menuData); DatMenu.dataBind(); MainMenu = DatMenu; var records = MainMenu.getRecordsHierarchy('id', 'parentid','items', [{ name: 'text', map: 'label'}]); $('#MainMenu').jqxMenu({ source: records, height: 30, width: '100%' ,theme:theme}); } });
my data :
Data return for getRecordsHierarchy
(3) […]
0: Object { id: 3, text: “Herramientas”, parentid: -1, … }
1: Object { id: 4, text: “Mi Cuenta”, parentid: -1, … }
2: Object { id: 5, text: “Acerca de …”, parentid: -1, … }my data return for php :
{…}
_bindingUpdate: Array []
_downloadComplete: Array []
_options: Object { }
_source: Object { datatype: “json”, id: “id”, recordstartindex: 0, … }
addrow: null
cache: false
cachedrecords: Array(9) [ {…}, {…}, {…}, … ]
deleterow: null
filter: null
koSubscriptions: Array []
loadedData: Array(9) [ {…}, {…}, {…}, … ]
mapChar: “>”
originaldata: Array(9) [ {…}, {…}, {…}, … ]
pageable: false
pagenum: 0
pagesize: 0
recordids: Array(52) [ <3 empty slots>, {…}, {…}, … ]
records: Array(9) [ {…}, {…}, {…}, … ]
totalrecords: 9
unboundmode: false
updaterow: null
virtualmode: false
<prototype>: Object { getrecords: getrecords()
, beginUpdate: beginUpdate(), endUpdate: endUpdate(), … }Hello Javier Hernandez,
I’ve made a demo Example with the exact code that you provided.
It doesn’t seem to have an issue. The menu is displayed as it should with the children data as sub menus.If you are getting a different result, the reason might be in the format of your php data.
Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.