We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Autocomplete with Remote Datasource

Thread ID:

Created:

Updated:

Platform:

Replies:

128534 Jan 26,2017 07:54 PM UTC Jan 30,2017 06:52 AM UTC JavaScript 4
loading
Tags: ejAutoCompleteTextBox
Matt Abercrombie
Asked On January 26, 2017 07:54 PM UTC

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

Arun Palaniyandi [Syncfusion]
Replied On 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.   
  
   
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.   


Matt Abercrombie
Replied On January 27, 2017 01:29 PM UTC

The sample link does not appear to be working.

Matt Abercrombie
Replied On January 27, 2017 02:02 PM UTC

The proposed solution worked perfectly. Thank you very much for the assistance and prompt response.

Ezhil S [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;