dataview loadNext

I am using loadNext when the ‘onAfterScroll’ event fired. If the no. of items in db is 400 and I have already reached at the end of the items loaded already in dataview, how to stop further?.

I wrote a logic if the start count of the required data reached total count, it will return a empty json. But I am getting error. How to do the above task?.

Hello,

You can add the check for total number in the onAfterScroll handler. The number of records in db can be passed with the response:

dhx.ajax(“info.php”, function(text){
var info = dhx.DataDriver.json.toObject(text);
total = info.total_count;
});

where info.php return the object with total_count property

Using total_count is giving the error when I bind the datastore to the dataview.

                                $$("MovieWallView").sync(datastore, this);
                                $$("MovieWallView").bind(datastore, function(data, obj){
                                        return data.TITLE_TYPE;
                                });
                                });

I got an error which says TITLE_TYPE of undefined. But without total_count in the json, it works fine.

try to load total_count with separate request:

dhx.ajax("info.php", function(text){ var info = dhx.DataDriver.json.toObject(text); total = info.total_count; $$("mylist").load("data.php"); .... });

I am using the following syntax for total_count.

{
pos: 0,
total_count: 400,
data: [{
}]
}

is it correct?.

You want to call the total_count in a separate php call by getting only the no. of rows?.

Here is what I meant:

info.php:

{ total_count : 100 }

data.php:

{ pos : 0, data : [ ... ] }

Thanks. That worked perfectly.

One more bug I found. I am initializing the datastore like below.

                                var datastore =  new dhx.DataCollection({
                                    datatype:"json"
                                });

I am loading the datastore via php call.

                                dhx.delay(function(){
                                        datastore.load("getXML.php?xml=getList&source="+sourcePath);
                                });

When I am using loadNext, nothing happened. I found the datastore.url is empty. How to set the url?. I want to load the data only required and not while initializing the datastore.