<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="lib/dhtmlx.css">
<script src="lib/dhtmlx.js"></script>
</head>
<body>
<div id="root" align="center" style="position:relative;top:10px;left:10px;width:300px;height:200px"></div>
<script type="text/javascript">
var ctxmenu = new dhtmlXMenuObject();
ctxmenu.renderAsContextMenu();
ctxmenu.attachEvent('onClick', function(id, zoneId) {
var id = zoneId.split('_')[0];
var idx = grid.getRowIndex(id);
grid.selectRow(idx);
var win = create_modal_window('win', id, 300, 200);
var form_items = [
{type: 'input', name: 'a'},
{type: 'input', name: 'b'},
{type: 'button', name: 'close', value: 'Click Me!'}
];
var form = win.attachForm(form_items);
form.attachEvent("onButtonClick", function(id) {
if (id == 'close') {
win.close();
}
});
form.bind(grid);
grid.setCursor(id);
});
ctxmenu.loadXML('test-ctxmenu.xml?etc=' + new Date().getTime());
var grid = new dhtmlXGridObject('root');
grid.setHeader("A,B");
grid.setInitWidths("100,100");
grid.setColAlign("left,left");
grid.setColTypes("ro,ro");
grid.setColumnIds("a,b");
grid.setSkin("dhx_skyblue");
grid.enableContextMenu(ctxmenu);
grid.init();
grid.loadXML("test.xml");
var dp = new dataProcessor("php/test.php");
dp.init(grid);
function create_modal_window(wid, title, w, h) {
var win = new dhtmlXWindows().createWindow(wid, 0, 0, w, h);
win.setText(title);
win.setModal(true);
win.center();
win.denyPark();
win.denyResize();
win.button('park').hide();
win.button('minmax1').hide();
return win;
}
</script>
</body>
</html>
Attached you can find a full sample to reproduce the problem. Steps to reproduce:
- After page is loaded, try to select any row in grid to make sure there are no errors
- Right click on any row. In context menu select any item. New window will be opened with selected row values populated to the input boxes.
- Click “Click Me!” button. Window will be closed.
- Click on any unselected row in the grid and check the error console. I have the following errors here:
a.callEvent is not a function
this.getItemType is not a function
order of errors is always the same.
test.tar.gz (1.13 KB)