Skip to Content

Master - Detail Next Item

We're working on an app that uses the Master-Detail template. This will be for a phone-sized device and this template works well. It displays the Master list view, then when you click on an item it displays the Detail view.

The business wants a "Previous" and "Next" buttons on the Detail view, so that the user can press that button and go to the next item on the Master list, without having to navigate back to the list first. I am wondering if there is a simple way to make this happen. I know I could do some fiddling around with arrays and whatnot, but I suspect that there is an easier way to navigate to the next item in the list.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 04, 2017 at 03:52 PM

    How about something like

    var selItemId=list.getSelectedItem().getId();
    var items=l.getItems()
    var itemIdx= items.map(function(x) {return x.sId; }).indexOf(selItemId);
    list.setSelectedItem(items[itemIdx + 1]);
    

    Regards,

    Jamie

    Add comment
    10|10000 characters needed characters exceeded