DataItemIndex in HierarchicalViewer, at level 0, returns only even numbers

Fabio Goto asked on September 4, 2018 22:04

Hi! I'm having some issues with the HierarchicalViewer.

I'm using it to render modal windows with some nested content, but at level 0, DataItemIndex always returns an even number.

So instead of "0, 1, 2, 3...", I'm having "0, 2, 4, 6, 8...".

Is this the normal behavior?

Correct Answer

Dragoljub Ilic answered on September 5, 2018 11:43

Hi Fabio,

It's only coincidence that you get only even numbers for DataItemIndex and that is because every item (folder) on level one probably have one child item. DataItemIndex is not specific to level of your transformation. It takes into account all items that you pulled in Hierarchical viewer. For example, if you have structure like shown bellow and you have two transformations for Folder and for Item, data item index will be:

-Folder 1 (DataItemIndex 0)
   -- Item 1 (DataItemIndex 1)
   -- Item 2 (DataItemIndex 2)
-Folder 2 (DataItemIndex 3)
   -- Item 3 (DataItemIndex 4)
-Folder 3 (DataItemIndex 5)
   -- Item 4 (DataItemIndex 6)

If you show data item index only in 'Folder' transformation, it will render numbers: 0, 3 and 5. Hope this will clarify your problem.

Best regards, Dragoljub

0 votesVote for this answer Unmark Correct answer

Recent Answers


Zach Perry answered on September 4, 2018 22:19

No that is not normal. Are you sure your odd number ones aren't hidden or off screen?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on September 4, 2018 22:31

Are your hierarchical transformations properly setup to look at the right page types? What about levels? Do you have an alternating item transformation?

0 votesVote for this answer Mark as a Correct answer

Fabio Goto answered on September 4, 2018 22:37

Thanks for answering.

I'm using a hierarchical transformation to list folders and their subitems (a custom page type) as modals. I've also limited the view to check only for folders and this custom page type. I'm also pretty sure that no folder is hidden away, as there's only 5 folders.

There's no alternating item transformation, only the ItemTransformation, Separator and Footer (which I'm using to close the last item).

For now, I've limited the Hierarchical view to show only level 0, to list only the folders. DataItemIndex still returns even numbers tho. 🤔

0 votesVote for this answer Mark as a Correct answer

Fabio Goto answered on September 5, 2018 14:38

Thanks Dragoljub Ilic, Brenden and Zach!

I always thought it kept a different index per level. So I need to be a bit more careful now then. 🤔

0 votesVote for this answer Mark as a Correct answer

Brett Stockley answered on August 22, 2019 04:50

Especially with HierarchicalViewer this sort of thing is a bit odd. This is an old post but we do find success in requirements using NodeOrder instead of DataItemIndex and DisplayIndex. With that I feel DisplayIndex should be rendering something different but seems to just be the same as DataItemIndex.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.