This is a migrated thread and some comments may be shown as answers.
remote data from AJAX
1 Answer 112 Views
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 2
Don asked on 12 Jul 2012, 12:41 AM
I have an autocomplete widget that works when I prepopulate the data from my ajax service but not when I use the DataSource Transport.

I am allowed to use json (dont need jsonp) but something else is the issue.
my table holds 60K employees so obviously I need to filter it down.
any ideas where I am making my mistake?
Thanks.


                 
                 var dataSource = [];  
                 var dataParam = [];
                 var remoteHost="http://www.myHost.com/Service.asmx/";
                 var remoteMethod ="getEmployees";
                                    
                 $(function () {                                         
                     // method 1: remotely hosted ajax - works with AutoComplete
                     callAjax(remoteMethod, dataParam, onSuccess);
                    
                     // method 2: Kendo Transport
                         $("#input").kendoAutoComplete({
                             minLength:3,
                             dataTextField:'Value',
                             dataSource:{
                                 serverPaging:true,
                                 pageSize:20,
                                 contentType:'application/json; charset=utf-8',
                                 type:'POST',
                                 dataType:'json',
                                 transport:{
                                     read: remoteHost + remoteMethod
                                 }
                             }
                         })
                 });                 

                // SUPPORT FUNCTIONS FOR METHOD #1
                 function onSuccess(data, status){
                     alert("got data");                    
                    // dataSource=data.d;                    
                    // buildAutoComplete();                    
                 }
                
                 function buildAutoComplete() {
                     $("#input").kendoAutoComplete({
                        minLength: 2,
                        dataTextField: "Value",
                        dataSource: dataSource                        
                     });                    
                 }

1 Answer, 1 is accepted

Sort by
0
Edemilson
Top achievements
Rank 1
answered on 30 Aug 2012, 02:08 PM
I have the same problem. Unfortunatelly there is no example with a custom e simple AJAX transport on Kendo web site, only the JSONP and ODATA examples, that are too much complex for my needs...
Asked by
Don
Top achievements
Rank 2
Answers by
Edemilson
Top achievements
Rank 1
Share this question
or