i'm working with couchdb as database.. i need show the data in pagination grid..
i can handle thenext page
proccess... but i am stack in how to handle previous page
after hard trying,... i can show previous json like this :
http://localhost/myapp/_view/getAll?limit=2&startkey=10&skip=1&descending=true
and the response :
{
total_rows: 21,
offset: 12,
rows: [{
id: "fd899e87f9f682a4df71d9e2a9010b26",
key: 9,
value: {
_id: "fd899e87f9f682a4df71d9e2a9010b26",
_rev: "1-ce4ed0e621ae53996f323a8927bcf470",
$type: "siswa",
Nama: "test9",
Agama: "Islam",
Hobi: ["Membaca","Menulis"]
}
} , {
id: "fd899e87f9f682a4df71d9e2a9010622",
key: 8,
value: {
_id: "fd899e87f9f682a4df71d9e2a9010622",
_rev: "1-45c71654623d385bd95f6970c72dce50",
$type: "siswa",
Nama: "test8",
Agama: "Islam",
Hobi: ["Membaca","Menulis"]
}
}]
}
the shown data is in reverse format.
as you can see, the response json start with key 9, and then 8.. so, the solution is reverse back in extjs / UI..how to reverse data from store in extjs 4 ?
in ext 3 i do that like this :this.store.reader.revers开发者_开发问答ed = true;
and then reload the store..You can sort you store like this:
Ext.create('Ext.data.Store', {
sorters: [
{
property : 'key',
direction: 'ASC'
}
// ...
}
or call store.sort('key', 'ASC');
精彩评论