Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kenny Burns 173 posts 305 karma points
    Jul 17, 2014 @ 14:28
    Kenny Burns
    0

    Override Tree - MNTP/DAMP Issue

    Hi all,

    I am trying to override the basetree (media) which is written out in various places in the back office (media section, image pickers etc...) and I am doing it through the ApplicationEventHandler:

    BaseTree.BeforeTreeRender += BaseTree_BeforeTreeRender;
    
    private void BaseTree_BeforeTreeRender(object sender, TreeEventArgs e)
            {
                //do stuff here to filter tree...
            }

    This is all working great as expected - however the trees within the multinode tree picker and digibiz advanced media picker are not filtering - i'm guessing they are not using the basetree? Is there any way to do somethign similar for the multinode tree picker - i read somewhere DAMP uses the same method?

    Thanks,

    Kenny

  • Kenny Burns 173 posts 305 karma points
    Jul 17, 2014 @ 15:49
    Kenny Burns
    100

    Hi All - 

    Solved it - here it is, in case anyone else needs it - and so I can remember it in future! This allows you to filter all trees, showing only the nodes you want.

    BaseTree.AfterTreeRender += BaseTree_AfterTreeRender;

     

    private void BaseTree_AfterTreeRender(object sender, TreeEventArgs e)
            {          
                var nodesToRemoveFromTree = new List<XmlTreeNode>();
                var ms = ApplicationContext.Current.Services.MediaService;
                foreach (var node in e.Tree.treeCollection)
                {
                   if (node.NodeType == "media" || node.NodeType == "DigibizMediaTree")
                    {
                        var content = ms.GetById(Convert.ToInt32(node.NodeID));
                        if (//do your logic)
                        {
                          nodesToRemoveFromTree.Add(node);                        
                        }
                    }
                }
     
               foreach (var treeItem in nodesToRemoveFromTree)
               {
                   e.Tree.Remove(treeItem);
               }
            }
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies