如何动态调整jqgrid到当前窗口大小? [英] How to dynamically resize jqgrid to current window size?
问题描述
如何动态调整jqgrid到当前窗口大小(基于javascript / jQuery)
最好的例子在这里(TinyMCE):
转到:。
How to dynamically resize jqgrid to current window size (based on javascript / jQuery)
Best example is here (TinyMCE): Goto: http://www.tinymce.com/tryit/full.php
Then try CTRL+ALT+F or Menu->View->Full Screen
Please help, i have beginner knowledge in js/jquery (i know more PHP language).
Thats how i call jqgrid:
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
..thanking in advance
This is what i ment if you understand me.
I would like to add custom button to the gridNav to function like switch between enlarged and normal view (like a tinyMCE editor has!!)
My grid table has many columns (long horizontal scroll) thats why i came to the idea to enrage the whole table.
The button code...
$buttonoptions = array("#pager", array(
"caption"=>"Resize",
"onClickButton"=>"js:function(){ ... resize call here ...}", "title"=> "Resize"
)
);
$grid->callGridMethod("#grid", "navButtonAdd", $buttonoptions);
function resizeJqGridWidth(grid_id, div_id, width)
{
$(window).bind('resize', function() {
$('#' + grid_id).setGridWidth(width, true); //Back to original width
$('#' + grid_id).setGridWidth($('#' + div_id).width(), true); //Resized to new width as per window
}).trigger('resize');
}
setGridWidth(new_width, shrink): Sets a new width to the grid dynamically.
new_width: It will be the new width (pixel).
shrink (default true) :
true -> It will allow to resize columns with in the grid according to the currently resized jqGrid width.
false -> It will append additional blank column at the end of jqGrid, if currently resized width of jqGrid will exceed its setup jqGrid width.
Courtesty of mfs.
这篇关于如何动态调整jqgrid到当前窗口大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!