Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tosh on Nov 09, 2008 12:19
open dhtmlx forum
dhtmlxMenu

setOverflowHeight was not working in dynamic loading. Strange things happend during menu display.
I edited the sample for dynamic loading (dynamic_loading.html) just to show as an example.

50 menu.setIconsPath("../images/");
51 menu.setOverflowHeight(4); /* code inserted by me */
52 menu.enableDynamicLoading("../common/dhtmlxmenu_dl.php");

I badly need this two to since i have a very huge menus with long subitem.
Thanks in advance...
Answer posted by Support on Nov 10, 2008 03:48
Right,

For the moment setOverflowHeight is render all loaded items.
Recommended way for usage:

menu.loadXML("mymenu.xml", function(){
    menu.setOverflowHeight(...);
});

For the dynamical content it will added in future release.
Answer posted by Tosh on Nov 10, 2008 22:19
I feel sad that i need to wait for the future release to use this functionality in dynamic loading. :(
By the way I made a quick fix for myself because I really badly needed this feature.
With that fix, I can now use the setOverflowHeight together with the dynamic loading but not so sure if I made it right.

On dhtmlxmenu.js line 215, I change the code from:
        var auId = "arrowup_"+id;
        var adId = "arrowdown_"+id;
        if (this.idPull["arrowup_"+id] != null) {
            arrowUp = this.idPull["arrowup_"+id];
            arrowUp.style.visibility = "hidden";
            arrowUp.style.display = "";
            arrowUp.style.zIndex = this.zInd;
            arrUpH = arrowUp.offsetHeight;
        }
        if (this.idPull["arrowdown_"+id] != null) {
            arrowDown = this.idPull["arrowdown_"+id];
            arrowDown.style.visibility = "hidden";
            arrowDown.style.display = "";
            arrowDown.style.zIndex = this.zInd;
            arrDownH = arrowDown.offsetHeight;
        }

TO CODE:
        var auId = "arrowup_"+id;
        var adId = "arrowdown_"+id;
        if (this.idPull["arrowup_"+id] == null) {
            this._addUpArrow(id.replace(this.idPrefix,""));    // Adding the up arrow if none was found
        }
       
        arrowUp = this.idPull["arrowup_"+id];
        arrowUp.style.visibility = "hidden";
        arrowUp.style.display = "";
        arrowUp.style.zIndex = this.zInd;
        arrUpH = arrowUp.offsetHeight;
       
        if (this.idPull["arrowdown_"+id] == null) {
            this._addDownArrow (id.replace(this.idPrefix,"")); // Adding the down arrow if none was found
        }
       
        arrowDown = this.idPull["arrowdown_"+id];
        arrowDown.style.visibility = "hidden";
        arrowDown.style.display = "";
        arrowDown.style.zIndex = this.zInd;
        arrDownH = arrowDown.offsetHeight;

And implementation will be:

    menu.setOverflowHeight(5);
    menu.enableDynamicLoading("xml_menu.php");

Hopes I have done it right. Works well on me so far.

Thanks,
Tosh