Attaching a popup to a grid cells

Hi,

Is it possible to attached a dhtmlx popup to a grid cells or a tree component?

in dhtmlxGrid you may try to use the onEditCell event to call the dhtmlxPopUp.
Here is the example of the code:

[code] mygrid.attachEvent(“onEditCell”, function(stage,rId,cInd,nValue,oValue){
if (stage==1){
var x = getAbsoluteLeft(this.editor.obj);
var y = getAbsoluteTop(this.editor.obj);
var w = this.editor.obj.offsetWidth;
var h = this.editor.obj.offsetHeight;
myPop.show(x,y,w,h);
}
if (stage==2){
myPop.hide();
}

    return true;
});[/code]

Thanks, I now have the popup working with a grid. Sorry but I should have read the earlier related post.

Is it possable to do a similar approach with a tree, i.e have a popup attached to a tree element which is displayed when it is selected?

You can try the approach below:

tree = new dhtmlXTreeObject("treeboxbox_tree2", "100%", "100%", 0); tree.setSkin('dhx_skyblue'); tree.setImagePath("../dhtmlx_pro_full/imgs/csh_bluebooks/"); tree.setDataMode("json"); tree.loadJSONObject({ id:'0', item:[ {id: '0-1', text: 'Item 1-0', item:[ {id: '0-1-0', text: 'Item 1-0-0'}, {id: '0-2-0', text: 'Item 2-0-0'}, {id: '0-3-0', text: 'Item 3-0-0'} ]}, {id: '0-2', text: 'Item 2-0', child: '1'}, {id: '0-3', text: 'Item 3-0', child: '1'} ]}); myPop = new dhtmlXPopup(); tree.attachEvent("onClick",function(id){ //var node = tree._globalIdStorageFind(id).htmlNode.firstChild.firstChild.lastChild; var node = tree._globalIdStorageFind(id).htmlNode; console.log(getOffset(node)); var x = getOffset(node).left; var y = getOffset(node).top; var w = node.offsetWidth; var h = node.offsetHeight; myPop.show(x - w/2,y,w,h); myPop.attachHTML(id); });

I have tried this approach and its really working! thanks for this…

You are welcome!