Developer forum

Forum » Development » NavigationProvider: Add child as first childnode?

NavigationProvider: Add child as first childnode?

Marie Louise Veigert
Reply

Hi Dynamciweb,

DW version: 9.2.17

I'm using the NavigationProvider to add childnodes to my Navigation XML.

It's a megamenu.

Ex: I have a group 'Men' with childs like 'Jackets' and 'Pants'.

Men

   Jackets

    Pants

 

I would like to have a node here:

Men

   All Products

   Jackets

    Pants.

 

I have got the node 'All products' last after the eCom (ex after pants) with 'AddChild'.

I don't want to make a group in eCom named 'All Products' because I would like it to be as easy for the editor as possible.

Is it possible to add it as the first child?

 

BR 
Marie Louise


Replies

 
Nicolai Pedersen
Reply

Can we see your code?

 
Marie Louise Veigert
Reply

I have attached my NavigationProvider.

 
Nicolai Pedersen
Reply

Can you zip it? .cs files looks too much like virus :-)

 
Marie Louise Veigert
Reply

Here you go :) 

 
Nicolai Pedersen
Reply

ok, thanks.

Try setting the NavigationItem.Sort = 0 before adding it as child. The best bet. Anyways, that should be reflected in the XML so you can sort the node in that.

Alternatively you have to take all children to a temp list, remove the childring, add you new item and add the temp list again. Kind of aggresive, but would probably work.

BR Nicolai

 

You must be logged in to post in the forum