Referencing grids created in other tabs/windows

Hi,

I have an application where I have a main window, that contains a Toolbar and a tabbar. This toolbar allows tabs to be added to the tabbar. I have created an instance of the window object in the main window html. As a tab is added, I attach a URL to that tab, which in turn builds a new grid. One of these tabs allows the creation of a new window, with a grid, to allow items to be added to the grid in the tab. To create the window, I reference the instance of the window created in the main window html (parent). However, when I try to reference the grid on the tab from this new window it doesn’t see it as existing. If I define the window in the tab, it works fine, but editing of the grid in the tab becomes corrupted. I have declared the grid in the tab as a global variable.

Can you please advise how best to reference the grid in the tab.

Regards

Gary

I attach a URL to that tab, which in turn builds a new grid
This may cause of the problem. If you attach page to the tab cell, variable defined inside this page is not visible at the page with tabbar

Hi Olga,

I actually have a small demo that illustrates the problem, but I currently run this on an Apache server running on iSeries. I’m not sure what I would need to extract and upload to allow you to see this. If you could please advise I will attempt to save the relevant files to a zip file and upload for you to see.

It shows both the corruption of the grid, and the problems referencing the grid from within a window in the tab.

Regards

Gary

Visibility of grid is not actually related to dhtmlxGrid component. You should organized your application property so necessary variables will be visible.

It shows both the corruption of the grid
We need any kind of demo to check why grid is corrupted

Hi Olga,

The visibility of the grid is related to the instance of dhxWins that is used though, isn’t it?

I have attached some demo code (in the zip) for you to look at to isolate the problem of the grid corruption, and a brief description of the problem in a text file.

If you have any questions please don’t hesitate to contact me.

Regards

Gary
fsoe.rar (672 KB)

If you click the Add items button this opens a new window, called Select Items to Add, but this window is created from the parent.dhxWins object (and the grid can’t be referenced in the new window created)

When you press “Add items” button, you create new dhtmlxWindow object and the attach url to it:

dhxWins2 = new dhtmlXWindows(); ... w2 = dhxWins2.createWindow("Addwdw", 20, 30, 860, 600); ... w2.attachURL("AddItems.html?tabhgt="+tabhgt+"&counter="+wscount+"&skulist="+skulist+"&maxrow="+maxrow, false);

At the AddItems.html file you initialize new dhtmlxGrid object:

mygrid3 = new dhtmlXGridObject('gridbox');

Do you mean that mygrid3 object cannot access to w2 window?

BTW, I would recommend you to do not use attachURL method to initialize content of the window. You can use attachObject method and attach necessary containers to the window. In such case all variables will be placed within one page namespace and it will be easily to maintain your project.

Hi Olga,

I will look at using the attachObject method rather than the attachURL method. If, as you suggest, it places things in one namespace, it may be that this will allow the new window to see mygrid2.

To refer to your earlier question, it wasn’t that mygrid3 object cannot access the w2 window, but that AddItems.html cannot reference mygrid2, which is part of EditOrder.html. Hope this makes sense.

Regards

Gary