Copy link to clipboard
Copied
There are times when you want to make slight changes to menus based on what a user does. It would be nice to simply "refresh" the menu (likely a cfdiv containing a cfmenu) using ColdFusion.navigate(..). However, if your menu contains cfmenuitems, they no longer appear ("drop down") after performing the navigate. If this is the intended behavior I think it is a major limitation. (CF9 and CF8)
code for my_test.cfm:
<cfajaximport />
<cfdiv id="myDiv">
<cfmenu name="my_menu" type="horizontal">
<cfmenuitem name="options" display="My Options">
<cfmenuitem name="option1" display="Option 1" href="javascript:ColdFusion.navigate('my_test.cfm','myDiv')" />
<cfmenuitem name="option2" display="Option 2" href="javascript:ColdFusion.navigate('my_test.cfm','myDiv')" />
<cfmenuitem name="option3" display="Option 3" href="javascript:ColdFusion.navigate('my_test.cfm','myDiv')" />
</cfmenuitem>
</cfmenu>
</cfdiv>
It turns out that if you remove any one of the cfmenuitem elements prior to doing the navigate the cfmenuitems work correctly...
<cfajaximport />
<script type="text/javascript">
function myNav() {
removeElements();
ColdFusion.navigate('my_test.cfm','myDiv');
}
function removeElements() {
var d = document.getElementById('myDiv');
var e = document.getElementById('option1');
d.removeChild(e);
}
</script>
<cfdiv id="myDiv">
<cfmenu name="my_menu" type=
...Copy link to clipboard
Copied
It turns out that if you remove any one of the cfmenuitem elements prior to doing the navigate the cfmenuitems work correctly...
<cfajaximport />
<script type="text/javascript">
function myNav() {
removeElements();
ColdFusion.navigate('my_test.cfm','myDiv');
}
function removeElements() {
var d = document.getElementById('myDiv');
var e = document.getElementById('option1');
d.removeChild(e);
}
</script>
<cfdiv id="myDiv">
<cfmenu name="my_menu" type="horizontal">
<cfmenuitem name="options" display="My Options">
<cfmenuitem name="option1" display="Option 1" href="javascript:myNav();" />
<cfmenuitem name="option2" display="Option 2" href="javascript:myNav();" />
<cfmenuitem name="option3" display="Option 3" href="javascript:myNav();" />
</cfmenuitem>
</cfmenu>
</cfdiv>