Adjust layout cell content onPanelResizeFinish

Hi,
I have the following layouts scheme:
-main layout based on document body:

dhxLayout = new dhtmlXLayoutObject(document.body,"3E","dhx_skyblue");
  • then sub layout based on one of main layout’s cell:
subLayout = new dhtmlXLayoutObject(dhxLayout.cells("b"), "3L","dhx_skyblue");
  • then layout based on one of sub layout’s cell:
ctgPanel = new dhtmlXLayoutObject(subLayout.cells("a"), "2E","dhx_skyblue");
  • and finally to objects attached to each cell of the last mentioned layout:

var ctgtop = document.getElementById("category"); ctgPanel.cells("a").attachObject(ctgtop); var treegrid = document.getElementById("treegrid"); ctgPanel.cells("b").attachObject(treegrid);
When browser’s window is resized everything works fine and elements of attached objects in the last layout (ctgPanel) are being adjusted according to sizes of the layouts. But when subLayout cells are resized then no adjustment happen. As I proper understand I have to attach function on onPanelResizeFinish that will do such adjustment, something like the following:

subLayout.attachEvent("onPanelResizeFinish", function(){ //some function that adjusts attached objects ]) But I cannot find that exact function within dhtmlxlayout library which called on browser window resizing and it adjusts all nested objects attached to cell in all layouts. Could you please name that function for me or reference me to the link where it is explained.
Thank you in advanced.

I found the solution. The problem laid a bit deeper than I expected at the beginning.
I was wrong when trying to call function setSizes for layout on “onPanelResizeFinish” event.
I didn’t take into consideration that the content inside div attached to layout cell contains div which was used for a dhtmlxgrid object to be initialized on.
In such particular situation all sizes of that inside content was under control of grid object, not layout itself. That’s why nothing happened when I called subLayout.setSizes().

So, instead of calling setSizes for layout on “onPanelResizeFinish” event I have to call setSizes for grid (in my case it is ctgtreegrid):

subLayout.attachEvent("onPanelResizeFinish", function(){ ctgtreegrid.setSizes(); ])
Now everything works fine.

Hi.

Actualy layout should be able to resize grid autiomaticaly if you using layout.attachGrid() (or subLayout.attachGrid). If you attaching object and then init grid manualy - yes, you need to resize grid with your code, because layout “don’t know” about grid attached.

Thank you for your response.
Yes, that’s right, layout.attachGrid() is the very useful method if there’s the only grid to be attached. Unfortunately, in my case instead of attaching the only grid to layout directly I have to manually attach div that contains several elements together with grid container.

Hello,

that’s correct, if you need several elemens.
but if you don’t need to view them all at once you can use “views”:
docs.dhtmlx.com/doku.php?id=dhtm … yout_views

and if you need some buttons - you can put them in statusbar (in layout cell) or on toolbar,
grid pading also can be done via statusbar:
docs.dhtmlx.com/doku.php?id=dhtm … _to_status

Thank you