I have a list having more than 100 items I want to show them 10 at one page and on click next button next 10 item appears.
How can i do this?
Is there any code reference for this?
I have a list having more than 100 items I want to show them 10 at one page and on click next button next 10 item appears.
How can i do this?
Is there any code reference for this?
Hello Tooba!
How to make pages in your application you can learn here: http://devcenter.appery.io/tutorials/...
Yeah I have gone through that tutorial but I want to know Can i do this for List component as well?
I have a list component which is populating from the local storage variable as my app is working for offline data.
localStorage.getItem('test');
this test variable has 100 rows having id, address and name values
I need only 10 rows on 1st page so how can i get the rows?
I want to show only 10 items in list for 1st page
Hi Tooba.
I don't know what is realy in your "test" LSV.
But, if you put in this LSV serialized(to JSON) array(as you specified before) so you can use following solution:
pre
var testString = localStorage.getItem('test');
//Convert string to the JS object.
var testArray = JSON.parse(testString);
//These two variables should replaced with your needs.
var itemsPerPage = 10;
var currentPage = 2;
var pagedData = [];
var startItem = itemsPerPage * currentPage;
var endItem = startItem + itemsPerPage;
if(endItem testArray.length)
endItem = testArray.length;
for(var i = startItem; i < endItem; i++)
pagedData.push(testArray[0]);
//Here is you need to use your pagedData.
console.log(pagedData);
/pre
Regards.
Thanks it worked ![]()