Categories | Question details Back To List | ||
onOpenEnd not fired on close - contrary to API Hi, The API says "onOpenEnd: Event raised immideatly after item in tree got command to open/close...", but apparently it is only raised in case I open a node. Is that possible? Any workaround? Thanks in advance Answer posted by Support on Jan 22, 2008 05:50 Event must work for both item opening and item closing. Please beware, that in case of dynamical loading, if you open multiple items at once ( with multiple separate calls to server ) - the event may fire not for all of opened items. If problem still occurs for you - please provide any kind of sample - you can send it directly to support@dhtmlx.com Answer posted on Jan 22, 2008 16:07 OK, we're both right :-) the event is fired after usual opening/closing, but it's never fired if I open/close the tree with tree.openItem(id)/tree.closeItem(id) Answer posted on Jan 22, 2008 16:11 ...which is annoying if you don't want to have node icons and plus/minus-icons, so you disable the plus/minus icons and therefore have to use the open() function within the click event Answer posted by Support on Jan 23, 2008 03:57 The original idea was to fire event when it caused by user, and not call it, when it caused by grid API You can modify tree code and add event to API calls dhtmlXTreeObject.prototype.openItem=function(itemId){ var temp=this._globalIdStorageFind(itemId); if (!temp) return 0; else return this._openItem(temp); this.callEvent("onOpenEnd",[itemId,this.getOpenState(itemId)]); //this will add event call to tree.openItem }; Answer posted on Jan 23, 2008 08:47 OK, my final (?) 2 cents: >> if (!temp) return 0; >> else return this._openItem(temp); >> this.callEvent("onOpenEnd",[itemId,this.getOpenState(itemId)]); //this will add event call to tree.openItem the last line is never called - as it's after the return statement Anyway: My last post was misleading, but as I wrote in the first post, the closing-a-node is the problem, so I added your line to the following function: dhtmlXTreeObject.prototype.closeItem=function(itemId){ this.callEvent("onOpenEnd",[itemId,this.getOpenState(itemId)]); //this will add event call to tree.openItem if (this.rootId==itemId) return 0; var temp=this._globalIdStorageFind(itemId); if (!temp) return 0; if (temp.closeble) this._HideShow(temp,1); }; Thanks Answer posted by Support on Jan 23, 2008 09:33 >>the last line is never called - as it's after the return statement agree, was a typo from my side |