Resizing subgrid on page resize

Hi,
I have a subgrid in my main grid.
My main grid resizes when I resize the page, but the expanded subgrid does not.

I tried the following in the ‘onSubGridCreated’ function

sub.setInitWidthsP(“3,18,5,73,1”);
sub.enableAutoHeight(true);
sub.enableAutoWidth(true);

sub.attachEvent(“onResize”, function(){sub.setSizes();});

How can I make the subgrid resize?
Is there a window resize event for subgrid?

Thanks,
Harini

Unfortunately we cannot reproduce this issue locally. Please provide us any kind of sample or a demo link so we can reproduce an error.

Thanks for the reply.
I’ve added a test file.

Is the subgrid supposed to resize automatically when the main grid resizes or does it need extra code?
Can you point me to an example where this is done?

Thanks,
Harini
test_resize.zip (1.55 KB)

You didn’t attach sub.xml file where is the configuration of your subgrid.
You need to add this into your sub.xml

<settings> <colwidth>%</colwidth> </settings>

Hi,
I tried that and it still did not work.
On debugging using Firebug, I can see that the div cgrid2_*, which contains the subgrid, does not resize. I added a function in javascript that will resize this div on a page resize. That did not work.
This function looks like:

var divLists = document.getElementsByTagName('div'); var index = 0; var divID; for(var i=0; i<divLists.length;i++) { divID = divLists[i].id; if (divID.search(/\bcgrid2/i)==0) { //set the height and width here based on parent element. } }

Do I need to set something else?
Thanks,
Harini
sub.zip (882 Bytes)

Try to add such function into your code

mygrid.attachEvent("onSubGridCreated", function(sub){ dhtmlxEvent(window, "resize", function(){ window.setTimeout(function(){ sub.callEvent("onGridReconstructed",[]); },200); }); return true; });

That worked.
Thank you very much!