jQWidgets Forums
jQuery UI Widgets › Forums › Editors › Input, Password Input, TextArea, ColorPicker, Rating, TagCloud, Loader › jqxInput autocomplete in full text search
This topic contains 8 replies, has 3 voices, and was last updated by Peter Stoev 10 years, 3 months ago.
-
Author
-
Hello! I have a problem. I’m using MSSQL full text search to find streets, cities, regions etc.
Here is my code (i taken it from example):$("#street").jqxInput({ searchMode: 'none', items:100, placeHolder: "Введите улицу", height: 28, width: 400, source: function (query, response) { var dataAdapter = new $.jqx.dataAdapter ( { datatype: "json", datafields: [ { name: 'Name' }, { name: 'Value'} ], url: '@Url.Action("StreetSearch")'+'?searchStr='+query+'&clientid='+clientId, }, { autoBind: true, formatData: function (data) { data.name_startsWith = query; return data; }, loadComplete: function (data) { //alert(data.length) - show data. We find text "So Da" if (data.length > 0) { response($.map(data, function (item) { return { label: item.Name, value: item.Value } })); } } } ); } });
Suppose i want search South Dakota.
If i input South or So or South Da – component work fine.
If i input text “So Da”, my function find South Dakota (see code alert(data.length))
but jqxinput control do not show search result.
Help me please.Hi uppitss,
Please, provide more information, because we cannot test your scenario using the provided details. As far as I see, you’ve overriden the Auto-Complete of the widget which means that the widget will display the data which your server sends to the client based on your query.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Yes. I input some text in text box. Then control send ajax jquery request to server. On the server side i seek streets in database. I use full text search on server side. Therefore if i input text “So Da” i will find variants “South Dakota”. But control not show me finded results.
I create simple example. To show my problem.
Client side:
<input style="padding-left:3px" type="text" id="street" /> <script> $("#street").jqxInput({ searchMode: 'none', items: 100, placeHolder: "Enter State", height: 28, width: 400, source: function (query, response) { var dataAdapter = new $.jqx.dataAdapter ( { datatype: "json", datafields: [ { name: 'Name' }, { name: 'Value' } ], url: '@Url.Action("TestStateSearch")' + '?searchStr=' + query, }, { autoBind: true, formatData: function (data) { data.name_startsWith = query; return data; }, loadComplete: function (data) { if (data.length > 0) { response($.map(data, function (item) { return { label: item.Name, value: item.Value } })); } } } ); } }); </script>
Server side (ASP .NET MVC C#):
public class TestStateSearchResult { public string Name; public string Value; public TestStateSearchResult(string number, string state) { this.Name = state; this.Value = number; } } public class CallcenterController : Controller { public JsonResult TestStateSearch(string searchStr) { //This is Example. We always return all states to demonstrate the problem List<TestStateSearchResult> retColl = new List<TestStateSearchResult>(); retColl.Add(new TestStateSearchResult("00","Alabama")); retColl.Add(new TestStateSearchResult("01","Alaska")); retColl.Add(new TestStateSearchResult("02","Arizona")); retColl.Add(new TestStateSearchResult("03","Arkansas")); retColl.Add(new TestStateSearchResult("04","California")); retColl.Add(new TestStateSearchResult("05","Colorado")); retColl.Add(new TestStateSearchResult("06","Connecticut")); retColl.Add(new TestStateSearchResult("07","Delaware")); retColl.Add(new TestStateSearchResult("08","Florida")); retColl.Add(new TestStateSearchResult("09","Georgia")); retColl.Add(new TestStateSearchResult("10","Hawaii")); retColl.Add(new TestStateSearchResult("11","Idaho")); retColl.Add(new TestStateSearchResult("12","Illinois")); retColl.Add(new TestStateSearchResult("13","Indiana")); retColl.Add(new TestStateSearchResult("14","Iowa")); retColl.Add(new TestStateSearchResult("15","Kansas")); retColl.Add(new TestStateSearchResult("16","Kentucky")); retColl.Add(new TestStateSearchResult("17","Louisiana")); retColl.Add(new TestStateSearchResult("18","Maine")); retColl.Add(new TestStateSearchResult("19","Maryland")); retColl.Add(new TestStateSearchResult("20","Massachusetts")); retColl.Add(new TestStateSearchResult("21","Michigan")); retColl.Add(new TestStateSearchResult("22","Minnesota")); retColl.Add(new TestStateSearchResult("23","Mississippi")); retColl.Add(new TestStateSearchResult("24","Missouri")); retColl.Add(new TestStateSearchResult("25","Montana")); retColl.Add(new TestStateSearchResult("26","Nebraska")); retColl.Add(new TestStateSearchResult("27","Nevada")); retColl.Add(new TestStateSearchResult("28","New Hampshire")); retColl.Add(new TestStateSearchResult("29","New Jersey")); retColl.Add(new TestStateSearchResult("30","New Mexico")); retColl.Add(new TestStateSearchResult("31","New York")); retColl.Add(new TestStateSearchResult("32","North Carolina")); retColl.Add(new TestStateSearchResult("33","North Dakota")); retColl.Add(new TestStateSearchResult("34","Ohio")); retColl.Add(new TestStateSearchResult("35","Oklahoma")); retColl.Add(new TestStateSearchResult("36","Oregon")); retColl.Add(new TestStateSearchResult("37","Pennsylvania")); retColl.Add(new TestStateSearchResult("38","Rhode Island")); retColl.Add(new TestStateSearchResult("39","South Carolina")); retColl.Add(new TestStateSearchResult("40","South Dakota")); retColl.Add(new TestStateSearchResult("41","Tennessee")); retColl.Add(new TestStateSearchResult("42","Texas")); retColl.Add(new TestStateSearchResult("43","Utah")); retColl.Add(new TestStateSearchResult("44","Vermont")); retColl.Add(new TestStateSearchResult("45","Virginia")); retColl.Add(new TestStateSearchResult("46","Washington")); retColl.Add(new TestStateSearchResult("47","West Virginia")); retColl.Add(new TestStateSearchResult("48","Wisconsin")); retColl.Add(new TestStateSearchResult("49", "Wyoming")); JsonResult r = Json(retColl, JsonRequestBehavior.AllowGet); return r; } }
I create three screenshots. The third screenshot display my problem.
Mirror (without authenticate)
https://yadi.sk/i/2p_7qF5OUwyhh
https://yadi.sk/i/kkdlH642Uwyjb
https://yadi.sk/i/2SkbqiCYUwyjyHi uppitss,
I am sorry. It seems your scenario is not supported by our Input widget. We will consider adding support for it in future versions.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comProbably control must disable search results found.
Can this be done?Hi, Peter! This problem is actual for me too. Did you add a support of this feature?
If not, maybe there is a workaround for custom drop-down list rendering???Hi roman.rx,
That is not a problem. That is a feature which we do not have. If you wish you can set the widget’s filter property to a custom callback function and filter each result in a custom manner.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.