开发者

jqGrid Resizing Problem

开发者 https://www.devze.com 2023-04-08 00:07 出处:网络
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 re开发者_JAVA百科sizes automatically however my jqGrid table doesn\'t. Actually

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 re开发者_JAVA百科sizes 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.


Here is a simple example you could try:

$(window).resize(function(){
    $("#confTable").setGridWidth($(this).width() * .95);        
});
0

精彩评论

暂无评论...
验证码 换一张
取 消