jQuery UI Widgets Forums Navigation Menu, Context Menu Cannot access ID or parent ID

This topic contains 3 replies, has 3 voices, and was last updated by  igikloppers 9 years, 2 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Cannot access ID or parent ID #61393



    I’m using Json data to populate the Menu. But I cant access the ID on click. it gives a generic id(like menuItem9903883167853252000). And how do I access other information, like the url?

    <head runat=”server”>
    <link rel=”stylesheet” href=”../../core/thirdparty/jqwidgets/styles/jqx.base.css” type=”text/css” />
    <script type=”text/javascript” src=”../../core/thirdparty/jQuery/js/jquery.min.js”></script>
    <script type=”text/javascript” src=”../../core/thirdparty/jqwidgets/jqxcore.js”></script>
    <script type=”text/javascript” src=”../../core/thirdparty/jqwidgets/jqxdata.js”></script>
    <script type=”text/javascript” src=”../../core/thirdparty/jqwidgets/jqxbuttons.js”></script>
    <script type=”text/javascript” src=”../../core/thirdparty/jqwidgets/jqxscrollbar.js”></script>
    <script type=”text/javascript” src=”../../core/thirdparty/jqwidgets/jqxmenu.js”></script>

    <script type=”text/javascript”>

    $(document).ready(function () {

    var postData = ‘{“CurrentPersonID”:”‘ + “A690CEE9-86DE-4700-BC08-D3F130643AC5″ + ‘”}’;
    var ListPageUrl = ‘/WholeFoodsMarket/applications/Setup/Menu.aspx/List’;
    type: “POST”,
    url: ListPageUrl,
    contentType: “application/json; charset=utf-8”,
    data: postData,
    dataType: “json”,
    cache: false,
    success: function (data) {
    var source =
    datatype: “json”,
    datafields: [
    { name: ‘ID’ },
    { name: ‘parentID’ },
    { name: ‘text’ },
    { name: ‘value’ }

    id: ‘ID’,
    localdata: data.d
    // create data adapter.0
    var dataAdapter = new $.jqx.dataAdapter(source);
    // perform Data Binding.
    // get the menu items. The first parameter is the item’s id. The second parameter is the parent item’s id. The ‘items’ parameter represents
    // the sub items collection name. Each jqxTree item has a ‘label’ property, but in the JSON data, we have a ‘text’ field. The last parameter
    // specifies the mapping between the ‘text’ and ‘label’ fields.
    var records = dataAdapter.getRecordsHierarchy(‘ID’, ‘parentID’, ‘items’, [{ name: ‘text’, map: ‘label’}]);
    $(‘#jqxWidget’).jqxMenu({ source: records, height: 30, theme: ‘energyblue’});
    $(“#jqxWidget”).on(‘itemclick’, function (event) {
    $(“#eventLog”).text(“Id: ” + event.args.id + “, Text: ” + $(event.target).val());
    error: function (msg) {
    // $(‘#ErrorMessage’).val(msg);


    <form id=”form1″ runat=”server”>


    <div id=’jqxWidget’>
    <div style=”margin-top: 50px; font-size: 13px; font-family: Verdana;” id=”eventLog”></div>

    Thank you!

    Cannot access ID or parent ID #61412


    Hello Priyam,

    The issue comes from the fact that you have “ID” and “parentID” and not “id” and “parentid”. You would have to map your properties, as you did with “text” (which is mapped to “label”).

    And could you clarify what url you need to access?

    Best Regards,

    jQWidgets team

    Cannot access ID or parent ID #66780


    Hi Dimitar,

    Could you perhaps explain how to map the “text” as “label”, as well as “ID” as “id” in the above scenario. In other words, is it possible to map more than one property? Also then, after the click event, how do I access those properties ?


    Cannot access ID or parent ID #66791



    I found the solution in part of the XML example, thanks –
    var records = dataAdapter.getRecordsHierarchy(‘ID’, ‘parentID’, ‘items’, [{ name: ‘text’, map: ‘label’}, { name: ‘id’, map: ‘ID’)]);


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

You must be logged in to reply to this topic.