PDA

View Full Version : How do you do two-layer navigation with dataviews?



evanc
19 Feb 2010, 10:44 AM
I'd like to use a store/dataview for navigation that will look like


Section 1 Page 1 Page 2 Page 3
Section 2 Page 1 Page 2 Page 3
Section 3 Page 1 Page 2 Page 3


How have others accomplished this? The way I've done this in the past is to use a store with a record for each top-level section, with an array field for each sub-level. This works because I can use an XTemplate with a sub-array. This works but I lose a lot of what makes dataviews cool.

I'm not sure I want to use a tree, because it's definitely only going to be two levels, and I'm going to be loading the data into a store anyway, so I'd rather just keep it there.

Any suggestions?

Animal
19 Feb 2010, 11:14 AM
You have something that works? What else are you asking for?

evanc
19 Feb 2010, 12:03 PM
using a store with array fields is sub optimal, because I lose selection handling, I lose a lot of the nice events (ie, instead of subscribing to the dataview's click event and then just getting the index of the line that was clicked, all I have is the index of the section clicked and I have to go through a few more steps to get at the actual clicked item), I lose the ability to easily update one line at a time, it greatly complicates the template, just off the top of my head.

I'm just asking if someone has a better idea. If there isn't, then I'll continue using the store with array fields technique.