remote data from AJAX

2 posts, 0 answers
  1. Don
    Don avatar
    38 posts
    Member since:
    Oct 2006

    Posted 11 Jul 2012 Link to this post

    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                        
                         });                    
                     }
  2. Edemilson
    Edemilson avatar
    6 posts
    Member since:
    Aug 2012

    Posted 30 Aug 2012 Link to this post

    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...
  3. Kendo UI is VS 2017 Ready
Back to Top