jQWidgets Forums
Forum Replies Created
-
Author
-
October 7, 2013 at 11:14 am in reply to: remote search at page load remote search at page load #30352
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.
October 7, 2013 at 10:59 am in reply to: remote search at page load remote search at page load #30351Following 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>
October 7, 2013 at 8:38 am in reply to: remote search at page load remote search at page load #30340Hi 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;} }}});
September 9, 2013 at 6:52 am in reply to: pagesizeoptions not working pagesizeoptions not working #28549Hi 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.
August 22, 2013 at 11:41 am in reply to: No keyboard navigation if jqxDragDrop appended No keyboard navigation if jqxDragDrop appended #27425Thank you, that solves the problem.
August 22, 2013 at 10:06 am in reply to: No keyboard navigation if jqxDragDrop appended No keyboard navigation if jqxDragDrop appended #27402Interesting what happens when user clicks on grid header? Maybe we could generate that event on grid load?
-
AuthorPosts