jQuery UI Widgets Forums Navigation Menu, Context Menu Ajax and ListMenu

This topic contains 4 replies, has 2 voices, and was last updated by  tomto 10 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Ajax and ListMenu #32655

    tomto
    Member

    Hello,

    How to load data on demand in ListMenu with ajax ? Like jqxTree.

    It is possible, i can’t found how ?

    Thank’s

     

    Ajax and ListMenu #32684

    Dimitar
    Participant

    Hello tomto,

    Here is an example:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxpanel.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    var listBox = $('#jqxListBox');
    var source = null;
    listBox.jqxListBox({ displayMember: "ContactName", valueMember: "CompanyName", width: 200, height: 250 });
    $("#loadData").click(function () {
    $.ajax({
    async: false,
    url: "source.htm",
    success: function (data, status, xhr) {
    source =
    {
    datatype: "json",
    datafields: [
    { name: 'CompanyName' },
    { name: 'ContactName' }
    ],
    id: 'id',
    localdata: $.parseJSON(data)
    };
    }
    });
    var dataAdapter = new $.jqx.dataAdapter(source);
    listBox.jqxListBox({ source: dataAdapter });
    });
    });
    </script>
    </head>
    <body class='default'>
    <button id="loadData">
    Load data</button>
    <div id="jqxListBox">
    </div>
    </body>
    </html>

    And here is the contents of source.htm:

    [
    {
    "CompanyName": "Alfreds Futterkiste",
    "ContactName": "Maria Anders",
    "ContactTitle": "Sales Representative",
    "Address": "Obere Str. 57",
    "City": "Berlin",
    "Country": "Germany"
    },
    {
    "CompanyName": "Ana Trujillo Emparedados y helados",
    "ContactName": "Ana Trujillo",
    "ContactTitle": "Owner",
    "Address": "Avda.de la Constitucin 2222",
    "City": "Mxico D.F.",
    "Country": "Mexico"
    },
    {
    "CompanyName": "Antonio Moreno Taquera",
    "ContactName": "Antonio Moreno",
    "ContactTitle": "Owner",
    "Address": "Mataderos 2312",
    "City": "Mxico D.F.",
    "Country": "Mexico"
    },
    {
    "CompanyName": "Around the Horn",
    "ContactName": "Thomas Hardy",
    "ContactTitle": "Sales Representative",
    "Address": "120 Hanover Sq.",
    "City": "London",
    "Country": "UK"
    }
    ]

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Ajax and ListMenu #32695

    tomto
    Member

    Thank’s
    I try this but i need the same for jqxListMenu, not jqxListBox. Apparently source is an invalid property for jqxListMenu, that’s correct ?.

    Best Regards
    Thomas

    Ajax and ListMenu #32711

    Dimitar
    Participant

    Hi Thomas,

    I am sorry for the misunderstanding. Unfortunately, content cannot be loaded on demand in jqxListMenu via Ajax. The widget does not have a source property either.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Ajax and ListMenu #32712

    tomto
    Member

    Ok, it’s a pity… maybe in the future…
    Thank’s

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

You must be logged in to reply to this topic.