Hi Rasika,

There is a table which shows process details in bpmn-explorer. When loading
process details to table, it does not load all the process data set at once
as there can be a huge nu. of data set in database by calling the osgi
service. Hence it shows 10 processes for one page of table. It is required
to use the pagination to show all the data.

So each pagination requires the osgi service call to load process details.

On Tue, Jun 21, 2016 at 7:42 PM, Rasika Perera <rasi...@wso2.com> wrote:

> Hi Sudharma,
>
> I need server side pagination for my requirements.
>
> I am not clear about the exact requirement. ​Pagination can be achieved
> with following options;
>
> ​[1]. Full page refresh with path params
>
> ​First option is that you can pass path parameters. For example;
> https://techcrunch.com/page/2/​, https://techcrunch.com/page/3/.
>
> +org.wso2.sample.app
>
> |----pages
>
>      `--articles
>
>         |-----{id}.hbs
>
>         `-----{id}.js
>
> function onRequest(env) {
>     return {"articles": getArticles(env.pathParams['id'])};
> }
>
> [2]. Fragments rendering​
>
> ​via AJAX​
>
> ​I think you can use fragments rendering feature for this. The idea is
> that inaddtion to the pages, fragments are accessible through the following
> api;
>
> http://localhost:9090/pets-store/fragments/devices​
> ​?offset=1&limit=10​
>
>
> You can use AJAX call to the above api and update relavant "div" on the
> page.
>
> ​This api call will look for​ a fragment in your application's fragments
> folder. Your query parameters "offset" and "limit" will be mapped as params
> for the fragment. You can also resuse the same fragment also in your pages.
>
> *device.hbs*
> =======
> <div class="row">
>
>     <div class="col-md-12">
>         {{#each devices}}
>             <div class="device">
>                 <span>Name : {{name}}</span>
>                 <span>Type : {{type}}</span>
>             </div>
>         {{/each}}
>     </div>
> </div>
>
>
> *devices.js*
> *======*
> function onRequest(env) {
>
>     var devices;
>     if (env.queryParams && (env.queryParams.offset && env.queryParams.limit)) 
> {
>         devices = getDevices(env.queryParams.offset, env.queryParams.limit);
>     } else {
>         devices = getDevices(0, 0);
>     }
>
>     return {"devices": devices}
> }
>
> function getDevices(offset, limit) {
>     var result = [{name: "device1", type: "android"}, {name: "device2", type: 
> "windows"}];
>     if (limit == 0) {
>         //no pagination
>         return result;
>     } else if (offset + limit <= result.size()) {
>         //valid pagination
>         result = result.slice(offset, limit);
>     } else {
>         //invalid pagination
>         result = [];
>     }
>     return result;
> }
>
> ​Thanks,
> Rasika​
>
>
> On Tue, Jun 21, 2016 at 3:53 PM, Sudharma Subasinghe <sudhar...@wso2.com>
> wrote:
>
>> I need server side pagination for my requirements.
>>
>> On Tue, Jun 21, 2016 at 12:28 PM, Hemika Kodikara <hem...@wso2.com>
>> wrote:
>>
>>> Hi Sudharma,
>>>
>>> [+ looping in Thusitha]
>>>
>>> If this is for a table, you can use datatable library[1]. There is a
>>> sample where this has been in used in [2] as well. But in this case, we
>>> have to bind all the rows(data) to the table upon onRequest method to the
>>> HTML table. The datatable library will provide the client side
>>> pagination(no http requests sent for pagination). Datatables also provide
>>> server side pagination as well, i.e when next page is clicked, it will send
>>> a HTTP request to get the rest of the data.
>>>
>>> But I am not aware on how to do server side pagination along with UUF.
>>>
>>> [1] - https://datatables.net/
>>> [2] - http://wso2-dev-ux.github.io/theme-wso2/layout.html (See "Data
>>> Table Template" title).
>>>
>>> Regards,
>>> Hemika
>>>
>>>
>>> Hemika Kodikara
>>> Software Engineer
>>> WSO2 Inc.
>>> lean . enterprise . middleware
>>> http://wso2.com
>>>
>>> Mobile : +94777688882
>>>
>>> On Tue, Jun 21, 2016 at 12:18 PM, Sudharma Subasinghe <
>>> sudhar...@wso2.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> How is the pagination supported by UUF? Is there any recommended lib
>>>> for that?
>>>>
>>>> Appreciate your ideas.
>>>>
>>>> Thanks
>>>> Sudharma
>>>>
>>>> --
>>>> Sudharma Subasinghe,
>>>> Software Engineer,
>>>> WSO2 Inc.
>>>> Email: sudhar...@wso2.com <hasi...@wso2.com>
>>>> Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>
>>
>> --
>> Sudharma Subasinghe,
>> Software Engineer,
>> WSO2 Inc.
>> Email: sudhar...@wso2.com <hasi...@wso2.com>
>> Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
>>
>
>
>
> --
> With Regards,
>
> *Rasika Perera*
> Software Engineer
> M: +94 71 680 9060 E: rasi...@wso2.com
> LinkedIn: http://lk.linkedin.com/in/rasika90
>
> WSO2 Inc. www.wso2.com
> lean.enterprise.middleware
>



-- 
Sudharma Subasinghe,
Software Engineer,
WSO2 Inc.
Email: sudhar...@wso2.com <hasi...@wso2.com>
Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to