Autocomplete with Remote Datasource
I have an autocomplete configured with a remote data source, which is calling and returning an array of data. However, the suggestion drop down does not appear.
HERE IS THE MARKUP:
<input type="text" class="icd-code-search-box" />
HERE IS THE JAVASCRIPT (the container object is a reference to the input above):
function configureICD10CodeSearch(container) {var dm = ej.DataManager({url: '/CommonDataControls/SearchICD',adaptor: new ej.UrlAdaptor});container.ejAutocomplete({dataSource: dm,query: ej.Query().select("ICD10Code", "Text"),fields: { key: "ICD10Code", text: "Text" },filterType: ej.filterType.Contains,watermarkText: "Search",actionComplete: function (args) {console.log('actionComplete');console.dir(args);}});}
HERE IS THE CONTROLLER ACTION:
public ActionResult SearchICD(DataManager dm)
{
DataManagerOperationResults results;
results = PerformDataManagerOperations(PatientProblemsModels.SearchICD(), dm);
return Json(new
{
ICD10CodeSearchResults = results.Data
}, JsonRequestBehavior.AllowGet);
}
When I inspect the args of the "actionComplete" event, the "result" contains the array "ICD10CodeSearchResults". The data in the array has fields "ICD10Code" and "Text". I am not sure how to set the configuration in order to have the suggestions bound correctly. Please advise.
Thanks,
Matt
SIGN IN To post a reply.
4 Replies
AP
Arun Palaniyandi
Syncfusion Team
January 27, 2017 10:54 AM UTC
Hi Matt,
Thanks for contacting Syncfusion Support.
We have tried to reproduce the corresponding issue by using shared code snippet and we were able to reproduce the issue. After checking the code, we found that you have passed the Json data in the controller through another object. Hence, the result data will be stored as the object type and the suggestion list is not generating. So, you have to return the Json data directly without any object.
|
public ActionResult SearchICD(Syncfusion.JavaScript.DataManagerdm)
{
//code
return Json(Data, JsonRequestBehavior.AllowGet);
} |
We have also prepared a sample for your reference in the below location.
Sample: http://www.syncfusion.com/downloads/support/forum/128534/ze/RemoteDataAutocomplete-1274532201
If this isn’t your scenario, please modify the sample based on your application for us to reproduce the issue, and help us to find the solution.
Regards,
Arun P.
MA
Matt Abercrombie
January 27, 2017 01:29 PM UTC
The sample link does not appear to be working.
MA
Matt Abercrombie
January 27, 2017 02:02 PM UTC
The proposed solution worked perfectly. Thank you very much for the assistance and prompt response.
ES
Ezhil S
Syncfusion Team
January 30, 2017 06:52 AM UTC
Hi Matt,
Thanks for the update.
We are glad the suggestion helped you to resolve the issue.
Please let us know if you need further assistance.
Regards,
Ezhil S
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
MA Matt Abercrombie
- Jan 26, 2017 07:54 PM UTC
- Jan 30, 2017 06:52 AM UTC