3 Replies Latest reply on Jul 8, 2010 3:15 AM by Schwarz Boris

    CFTree refresh



      I have a CFTree bind with a CFC (classic) :

      <cfform name="formRootNode" format="html" style="margin:0px;">
          <cftree name="RootNode" height="400" width="200" format="html">
              <cftreeitem bind="cfc:_cfc.cTree.getNodes({cftreeitemvalue},{cftreeitempath})">
      <cfinput type="button" name="btnRefresh" value="test" onclick="javascript:(ColdFusion.Tree.refresh('RootNode'));" />

      but when I click on the refresh button i have an error and i don't know why :

      " _1b.parent is null " (/CFIDE/scripts/ajax/package/cftree.js, line 219)


      Does anyone know how to fix it ?


      PS : I work with coldfusion 9

        • 1. Re: CFTree refresh
          Schwarz Boris Level 1

          I was having the same problem during the last days and hacking into /CFIDE/scripts/ajax/package/cftree.js is the only solution I can come up with:


          Look for the function "ColdFusion.Tree.formPath" (line 214) and manipulate it as following:



          var _1d=ColdFusion.objectCache[_1b.tree.id+"collection"];
            return "";
            if(_1b.parent==null) return ""; // Adding this line removes the error
             return "";
          var _1e=ColdFusion.Tree.formPath(_1b.parent,_1c);
          return _1e;



          Makes the <cftree> refresh, but closes all nodes on my binded tree. But that's probably how it's supposed to be... Hopefully others find this helpful.


          Cheers, Boris




          You could probably just add this function to your regular JavaScript and override the CF-generated one. Manipulating CFIDE could affect others of your application.


          Message was edited by: Schwarz Boris

          • 2. Re: CFTree refresh
            Kaias26 Level 1

            hi Boris, thanks for your answer but i have found a better way to solve my problem :


            when i update my tree (change or delete a node for exemple), i call a js function :



            var :

            var oTree = ColdFusion.Tree.getTreeObject('RootNode');
            var currentNode=oTree._cf_node;
            var mynode=oTree.getNodeByProperty('id',currentNode);
            var    mynodeparent = mynode.parent;


            LoadNodes refresh only the parent node (and all their children inside), then i expand the parent (so that will not close my other nodes )



            • 3. Re: CFTree refresh
              Schwarz Boris Level 1

              Awesomeness! That's even cooler than ColdFusion.Tree.refresh. The only issue I'm having is when I need to reload a node that hasn't got a Parent-Node.


              I guess I'll have to go with ColdFusion.Tree.refresh in that special case.


              But anyway, thanks for your solution.