0

I have a jqGrid at my web page. I have a resizing problem. When I restore down my web page, all the elements at my page resizes automatically however my jqGrid table doesn't. Actually I have edited my table's width as follows:

...
width:1000,
...

I want it has a minimum width but have a automatic resizing when I restore down (get more smaller) my web page.

How can I do that?

EDIT:

I tried thatbut I am not sure is this the right way: confTable is my jqGrid id and content is the parent element's id of it.

$("#confTable").jqGrid('gridResize', { minWidth: 800, minHeight: 100 });
$(window).bind('resize', function() {
                var gridWidth = $("#confTable").width();
                var contentWidth = $("#content").width();                    
                if (gridWidth > 0 &&                      
                        Math.abs(gridWidth - contentWidth) > 5) {
                    $("#confTable").jqGrid('setGridWidth', contentWidth);
                }

 }).trigger('resize');

I wanted to implement the solution here described. However setgridWidht and the lines of .attr() didn't work. Is my code browser compatible and what is the wrong can be while I was trying the implement the solution of that question?

PS:

It says: $("#confTable").setGridWidth is not a function. Actually I need to resize my jqGrid according to its parent's parent.

Community
  • 1
  • 1
kamaci
  • 72,915
  • 69
  • 228
  • 366

1 Answers1

0

Here is a simple example you could try:

$(window).resize(function(){
    $("#confTable").setGridWidth($(this).width() * .95);        
});
Dave L.
  • 9,595
  • 7
  • 43
  • 69
  • It says: `$("#confTable").setGridWidth is not a function` and what this refers there? Actually I need to resize my jqGrid according to its parent's parent. – kamaci Sep 26 '11 at 21:06
  • this would refer to the window object there. i just chose that as a test example. are you using the latest verion of jqGrid? my example works for me using the latest. – Dave L. Sep 27 '11 at 15:21