javascript - jqgrid autowidth and shrinkToFit not fitting exaclty -
i have created page loads many grids page when page loads. idea grids need adjust width fit width of page when page loads. works perfectly 1 grid visible when page loads, using these options:
shrinktofit: true, autowidth: true, 
notice columns fit perfectly, , no horizontal scroll bar shows up. other grids load in hidden areas of screen, using same options above, not load correctly:

i tried fix issue using method manually set width, using setgridwidth, setting width of hidden grids width of 1st grid, right width. using method, width of hidden grid correct, shrinktofit option not setting width of columns correctly, see here:

while grid looks correct, can see column widths do not fit correctly horizontal scroll bar shows up. becomes bigger problem when grid loads many subgrids. becomes mess:

the horizontal scroll bars take space, , wish shrinktofit work correctly, neat , clean.
i hope explained problem enough, know how can shrinktofit option work correctly these grids loaded in hidden areas of page? thanks!
edit
here code definition of subgrids. can see use setgridwidth @ end:
... subgrid: true, subgridoptions: { "plusicon" : "ui-icon-triangle-1-e", "minusicon" : "ui-icon-triangle-1-s", "openicon" : "ui-icon-arrowreturn-1-e", // load subgrid data once // , show/hide "reloadonexpand" : true, // select row when expand column clicked "selectonexpand" : true }, subgridrowexpanded: function(subgrid_id, row_id) { var subgrid_table_id, pager_id; subgrid_table_id = subgrid_id+"_t"; var po_num = jquery('#po_list').jqgrid ('getcell', row_id, 'po_num'); $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table></div>"); jquery("#"+subgrid_table_id).jqgrid({ url:"/phpajax/master/master_grid_v1.php", datatype: "xml", shrinktofit: true, autowidth: true, mtype: 'post', postdata:{ arg1:'pos', po_num:po_num }, colnames:[ 'row id', ... ], colmodel:[ {width:20,name:'row_id', index:'row_id',editable:false,hidden:true}, ... ], loadonce:true, pager: pager_id, sortname: 'row_id', sortorder: "asc", height: '100%' }).setgridwidth($("#inv_list").width()*.95); }
Comments
Post a Comment