jQWidgets Forums

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: remote search at page load remote search at page load #30352

    mijus
    Participant

    Update. Two server calls are performed every time user enters new search string. The first goes with previous search string parameter and the second with recent one.

    in reply to: remote search at page load remote search at page load #30351

    mijus
    Participant

    Following your idea I have modified sample code so combobox is created without source parameter. That parameter is added when user clicks on combobox div and then first server call is performed. This solution removes server call on page load.

    However new strange problem appears. When user enters 2 search string characters 2 server calls are made. First call contains no “name_startsWith” parameter and the second one goes with correct search string in “name_startsWith”.

            $(document).ready(function () {
    var theme = getDemoTheme();
    // prepare the data
    var source =
    {
    datatype: "jsonp",
    datafields: [
    { name: 'countryName' },
    { name: 'name' },
    { name: 'population', type: 'float' },
    { name: 'continentCode' },
    { name: 'adminName1' }
    ],
    url: "http://ws.geonames.org/searchJSON",
    data: {
    featureClass: "P",
    style: "full",
    maxRows: 12
    }
    };
    var dataAdapter = new $.jqx.dataAdapter(source,
    {
    formatData: function (data) {
    if ($("#jqxcombobox").jqxComboBox('searchString') != undefined && $("#jqxcombobox").jqxComboBox('searchString')) {
    data.name_startsWith = $("#jqxcombobox").jqxComboBox('searchString');
    return data;
    }
    }
    }
    );
    $("#jqxcombobox").jqxComboBox(
    {
    width: 250,
    height: 25,
    // source: dataAdapter,
    remoteAutoComplete: true,
    autoDropDownHeight: true,
    theme: theme,
    selectedIndex: 0,
    displayMember: "name",
    valueMember: "countryName",
    renderer: function (index, label, value) {
    var item = dataAdapter.records[index];
    if (item != null) {
    var label = item.name + ", " + item.countryName + ", " + item.adminName1;
    return label;
    }
    return "";
    },
    renderSelectedItem: function(index, item)
    {
    var item = dataAdapter.records[index];
    if (item != null) {
    var label = item.name + ", " + item.countryName + ", " + item.adminName1;
    return label;
    }
    return "";
    },
    search: function (searchString) {
    dataAdapter.dataBind();
    }
    });
    $("#jqxcombobox").click(function(){
    var source = $('#jqxcombobox').jqxComboBox('source');
    if (source == null) {
    $("#jqxcombobox").jqxComboBox({source: dataAdapter});
    }
    });
    });
    </script>
    </head>
    <body class='default'>
    <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
    <span>Search for a City:</span>
    <div style="margin-top: 7px; margin-bottom: 5px;" id="jqxcombobox"></div>
    </div>
    </body>
    </html>
    in reply to: remote search at page load remote search at page load #30340

    mijus
    Participant

    Hi Peter,

    Perhaps I don’t understand whats going on in “formatData” function. I changed sample to this but call to server at page load is still performed:

    var dataAdapter = new $.jqx.dataAdapter(source,
    {
    formatData: function (data) {
    if ($("#jqxcombobox").jqxComboBox('searchString') != undefined) {
    data.name_startsWith = $("#jqxcombobox").jqxComboBox('searchString');
    if (data.lenght > 0) {
    return data;
    }
    }
    }
    }
    );
    in reply to: pagesizeoptions not working pagesizeoptions not working #28549

    mijus
    Participant

    Hi Peter,

    I’m looking at Paging demo (/demos/jqxgrid/paging.htm).

    After setting properties

    pagesizeoptions: [’20’, ’35’, ’50’],
    pagesize: ’20’,

    the grid is not displayed.


    mijus
    Participant

    Thank you, that solves the problem.


    mijus
    Participant

    Interesting what happens when user clicks on grid header? Maybe we could generate that event on grid load?

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