This is a migrated thread and some comments may be shown as answers.

DataSource change event not working on iPhone

3 Answers 58 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joseph Roberts
Top achievements
Rank 1
Joseph Roberts asked on 23 Apr 2013, 01:57 PM
I have a Datasource which I have defined a change event for.  The change event is called and fired perfectly in the simulator.  The event does not fire on my iPhone.  Any idea why?

Thanks,
Joe

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 24 Apr 2013, 01:31 PM
Hi Joe,

The provided information is insufficient to determine what is wrong with your Kendo DataSource. If you still need our help, please elaborate on your setup and possibly provide us with a jsfiddle sample that exhibits the issue.

You can also look at the following threads and see whether you're not missing anything:

All the best,
Steve
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Kendo UI Dojo.
0
Joseph Roberts
Top achievements
Rank 1
answered on 25 Apr 2013, 12:50 PM
I can't create a JSFiddle as my project uses a local web service, but I have attached my code.  The code execute perfectly in the Graphite and Mist simulators.  The event just doesn't fire on my iPhone when I have it connected to graphite using LiveSync. 

Here is my code...

define(["jQuery", "kendo", "config", "utils"], function ($, kendo, config, utils) {
    
    var DataSource2Config = function (url, sortField, options, changeMethod) {
        this.transport = {
            read: {
                url: url,
                type: "POST",
                contentType: "application/json"
            },
            parameterMap: function(options) {
                return kendo.stringify(options);
            }
        };
        this.change = changeMethod;
        $.extend(this, options || {});
    };
        
    DataSource2Config.prototype = {
        type: "json",
        schema : { total : function() { return 0; } },
        requestStart: function () { if (this.pageSize() === undefined || this.page() === 1) { utils.showLoading(); }}, //infinite scrolling has its own, less obtrusive indicator
        requestEnd: function () { utils.hideLoading();},
        error: function () { utils.hideLoading(); utils.showError("There was an error loading the data from the server. Please close the app and try again."); }
    };   
    
    var EndlessScrollDataSource = kendo.data.DataSource.extend({
        /*_observe: function(data) {
            console.log("EndlessScroll");
            if(this._page > 1) {
                this._data.push.apply(this._data, data);
                return this._data;
            }
            return kendo.data.DataSource.prototype._observe.call(this, data);
        }*/
    });   

return {
        clear: function (dataSource) {
            dataSource.view().splice(0, dataSource.view().length);
        },        searchList: new EndlessScrollDataSource(new DataSource2Config(config.searchUrl, "Num", {
            serverPaging: true,
            serverFiltering: true,
            serverSorting: false,
            pageSize: 10
        }, function (e) {
            //console.log("change!!");
            if (e.items.length == 0){
                $("#search-no-results").show();
                $("#search-listview").hide();
            }
            else{
                $("#search-no-results").hide();
                $("#search-listview").show();
            }
        })),
    };
});
0
Joseph Roberts
Top achievements
Rank 1
answered on 25 Apr 2013, 12:57 PM
Wow real crazy.  I have since made a bunch of changes, and things seem to be working now.  Sorry.
Tags
General Discussion
Asked by
Joseph Roberts
Top achievements
Rank 1
Answers by
Steve
Telerik team
Joseph Roberts
Top achievements
Rank 1
Share this question
or