When we you want to paginate the results in our gadget template, we you can use the multidatasource approach, that allow us you to perform some server transformation like: limit, group, select, param, where, …
In our your sample, we you can get the data page by page with the following instructionstatement:
vm.from("{{datasource}}").skip(step*bulk).limit(bulk).exec().then
Now we , you can iterate through the results with, for example, the recursive async function iterateResult. It’s necessary You need to call it first with the inicial paramsinitial parameters:
Code Block | ||
---|---|---|
| ||
vm.acum = []; var bulk = 1000; var step = 0; iterateResult(vm.acum, step, bulk, callback); |
The callback function will be call when all the data have has been recoveredretrieved:
Code Block | ||
---|---|---|
| ||
//function for doing something after all records are recover function callback(){ alert("Recovered " + vm.acum.length + " records") } |
...