views:

91

answers:

2

I have a link on web page

<li data="url: 'www.mypage.com?index.php?CId=2&MId=14&MTId=1'">mylink

In my js script I have

$(document).ready(function() {

 $("#tree").dynatree({
 persist: true,

 onPostInit: function(isReloading, isError) {
        this.reactivate();
 },

 onActivate: function(dtnode) {
        var isInitializing = dtnode.tree.isInitializing(); 
        var isReloading = dtnode.tree.isReloading(); 
        var isUserEvent = dtnode.tree.isUserEvent(); 

       if( dtnode.data.url )
          window.open(dtnode.data.url); 

}   

    });

});

What should I do instead of window.open so the url reloads in the same window, not opening a new one? There's no name in the web page where I could use iFrame way.

A: 

have you tried this solution:

$(document).ready(function() {

   $("#tree").dynatree({ persist: true,

      onPostInit: function(isReloading, isError) { this.reactivate(); },

      onActivate: function(dtnode) { 
         var isInitializing = dtnode.tree.isInitializing(); 
         var isReloading = dtnode.tree.isReloading(); 
         var isUserEvent = dtnode.tree.isUserEvent();

         if( dtnode.data.url )
            window.location.href = dtnode.data.url; 
      }
   });
});
Falle1234
Hi FelleI would love to hear from you of an answer of another side-effect issue below.
chz
Hi FelleWhen I execute with Dynatree, I saw the html content it generated The html file shows <div> <span class="ui-dynatree-folder ui-dynatree-expanded ui-dynatree-has- children ui-dynatree-lastsib ui-dynatree-exp-el ui-dynatree-ico-ef" id="ui-dynatree-id-id3.2"> <span class="ui-dynatree-empty"></span> <span class="ui-dynatree-expander"></span> <span class="ui-dynatree-icon"></span> <a href="#" class="ui-dynatree-title">Click Me here</a> </span>
chz
<div><span class="ui-dynatree-document ui-dynatree-lastsib ui-dynatree- exp-cl ui-dynatree-ico-c" id="ui-dynatree-id-_8"> <span class="ui-dynatree-empty"></span> <span class="ui-dynatree-empty"></span> <span class="ui-dynatree-connector"></span> <span class="ui-dynatree-icon"></span> <a href="#" class="ui-dynatree-title">Inside Click Me here</a></span> </div>
chz
Bad formatting let me try
chz
Stackoverflow stops me from posting cuz of lack of points
chz
RetryIn my current front.tpl file, =================== <li data="url: '{$obj->mCType[k].link_to_type}'">{$obj->mCMType[k].name} <li data="url: '{$obj->mCType[k].link_to_type2}'">{$obj->mCMType[k].name2} <li data="url: '{$obj->mCType[k].link_to_type3}'">{$obj->mCMType[k].name3} <li data="url: '{$obj->mCType[k].link_to_type4}'">{$obj->mCMType[k].name4} When clicking on any of the above, hovering my mouse over them show. http://localhost/people/#. After clicking and page reloads, the right screen shows correct input.
chz
chz
<script src="{$obj->mSiteUrl}test/lib/jquery-1.4.2.min.js" type="text/ javascript" charset="utf-8"></script> <script src="{$obj->mSiteUrl}test/lib/jquery-ui-1.8.custom.min.js" type="text/javascript" charset="utf-8"></script> <script src='{$obj->mSiteUrl}dynatree-0-5-4/jquery/ jquery.cookie.js' type='text/javascript'></script> <link href='{$obj->mSiteUrl}dynatree-0-5-4/src/skin/ui.dynatree.css' rel='stylesheet' type='text/css'>
chz
<script src='{$obj->mSiteUrl}dynatree-0-5-4/src/ jquery.dynatree.min.js' type='text/javascript'></script> <script type="text/javascript" src="{$obj->mSiteUrl}dynatree-0-5-4/ script_dynatree.js"></script> For sure we need url: '{$obj->mCType[k].link_to_type} Is there a way to replace # with actual url string inside using dyna rules ? <li data="url: '{$obj->mCType[k].link_to_type}'">{$obj- >mCMType[k].name but do I pass another parameter to replace # of href of ui-dynatree- title ?
chz
Even with the change, will it affect the parent nodes since they're not hyperlinks to elsewhere but expand/collapse tree.
chz
A: 

Hi Felle Thank you for responding. Your solution works but is causing a side effect. For whatever reason, all my nodes have this pattern of hyperlinks: Click me

the pattern is the a class="ui-dynatree-title" href="#" so that whenever I click the link, all the nodes are expanded.

How do I change the href value such that it uses the unique dtnode.data.url value, also in the OnActivate function, once i click on it ?

Sincerely

chz
I am not sure what the problem is. Could you try and elaborate what is supposed to happen and how it fails.
Falle1234