Dashboard view currentPage and scrollTo

You must Login before you can answer or comment on any questions.

I've experienced few bugs with the Dashboard View, not saying that it doesn't work, on the contrary it works just fine but needs to be improved.

The only problem I'm having with it right now is determining the currentPage and how can I change it dynamically, does any one has the answer to this question.

I would also love to see an example on how to find out the order of the Dashboard Items in a situation where you have to re-organise them, I've tried playing a bit with the move event to find out the order of these items but with no luck, maybe someone can help me with this please.

Your help will be highly appreciated.

Thanks,

3 Answers

Not sure about determining the current page, but here's how to determine what order the items are in after you've moved them around:

It comes from dashboard.data[x] ...

There is a 'label' property for each item in the dashboard. This label contains a string that identifies the item, so to see the new order of the dashboard after a 'commit' event you could do:

for (var i=0;i<dashboard.data.length;i++) { Ti.API.info('label ' + dashboard.data[i].label); }

Remember, in order to preserve this order, you'll need to either save them to your application properties, or to a database stored on the device (iPhone, etc.), which is the route I've taken ...

Good luck -- Hope this helps!

Randy

Mate, thank you very much for your help but that doesn't seem to work, I'm still getting the same order even after I move the icons around, here is my code:

iconsDashboardView.addEventListener('commit', function(e) { for (var i=0;i<iconsDashboardView.data.length;i++) { Ti.API.info('label ' + iconsDashboardView.data[i].label); } });

I figured out why the Dashboard View doesn't default to the first page, it's because I had to compile my App using the latest Titanium SDK, just thought I'd share this with you guys in case you are running through a problem I was having whenever I used to display the Dashboard it used to default to the last page instead of the first page.

However I still dont know how to change the CurrentPage of the Dashboard View dynamically, any body got a clue.

Your Answer

Think you can help? Login to answer this question!