博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
//=========
$(window).resize(function(){
    $("#confTable").setGridWidth($(this).width()*.95);        
});

原问题代码:??

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.