четвъртък, 16 януари 2014 г.

JavaScript DataSource paging

In this blog entry, we look in closer datail into the paging capabilities of the ShieldUI DataSource JavaScript component.
To specify page parameters, use the skip and take initialization settings when creating a new DataSource instance:
1
2
3
4
5
6
7
8
9
var ds = new shield.DataSource({
    data: [/*...*/],
    skip: 5,
    take: 10
});
ds.read().then(function () {
    var dataView = ds.view;
    //dataView contains paged data
});
To set paging parameters after initialization, use the skip and take properties of the component:
1
2
3
4
5
6
7
ds.skip = 7;
ds.take = 12;
 
ds.read().then(function () {
    var dataView = ds.view;
    //dataView contains new page of data
});
By default skip and take operations are applied after the data is read. If binding to a remote endpoint is used and the DataSource.remote.operations array contains “skip” and/or “take”, the respective skip/take parameters are sent to the remote endpoint. In this case, the DataSource is configured for remote paging and does not apply skip and take locally.

Няма коментари:

Публикуване на коментар