Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by pyt on Nov 19, 2008 09:25
open dhtmlx forum
problem with grid and windows

Hi,
i use dhtmlxgrid v.1.6. I have created a contextmenu in grid. Now i want to display a dhtmlxWindow, by clicking the item in context menu. I use the following codes in js:

function onButtonClick(itemId,itemValue){
dhxWins= new dhtmlXWindows();
dhxWins.setImagePath("/codebase/imgs/");
dhxWins.enableAutoViewport(false);
dhxWins.setViewport(0, 0, 1024, 1024);
if( itemId == "addNotes"){    
    var w1 = dhxWins.createWindow("w1",0,0,200,200);
    w1.setText("addNotes");
    w1.attachURL("/codebase/context_menu_add.html");
    w1.center();

}
else if(itemId == "showNotes"){
    var w2 = dhxWins.createWindow("w2",0,0,200,200);
    w2.setText("showNotes");
    w2.attachURL("/codebase/context_menu_add.html");
    w2.center();

}
else if(itemId == "deleteNotes"){
    alert("Your Notes are deleted!");     
    
}
return true;

}
function doInitGrid(){
aMenu=new dhtmlXContextMenuObject('120',0,"/images/menu_imgs/");
aMenu.menu.loadXML("/codebase/_context2.xml");
aMenu.setContextMenuHandler(onButtonClick);

mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.setImagePath("/images/imgs/");
mygrid.enableContextMenu(aMenu);

...
}


The first time it works right. But later it shows me the contextmenu from firefox.
Can you help me?

Thanks in advance!
pyt

















Thanks in advance!
pyt
Answer posted by Support on Nov 21, 2008 05:06
Hello,

Problem is in viewport. When you using the following code:
    dhxWins.setImagePath("/codebase/imgs/");
    dhxWins.enableAutoViewport(false);
    dhxWins.setViewport(0, 0, 1024, 1024);
windows creates viewport which is placed over grid. So first time there is no viewport and you able to click grid,
second time here is a viewport placed and your click does not reach the grid.

Please review the following links:
http://dhtmlx.com/docs/products/dhtmlxWindows/samples/viewports/default.html?un=1227272603000
http://dhtmlx.com/docs/products/dhtmlxWindows/samples/viewports/render_as.html?un=1227272657000
http://dhtmlx.com/docs/products/dhtmlxWindows/samples/viewports/specify.html?un=1227272688000

You are using 3rd variant. Try 1st or 2nd.