Make jqGrid fill its container

后端 未结 3 2046
再見小時候
再見小時候 2020-12-20 17:08

I am using the jQuery layout plugin and the jqGrid plugin in one of my projects and they work great except for a little problem...

I want the jqGrid to fill up compl

3条回答
  •  感情败类
    2020-12-20 17:50

    I'm using jqgrid 4.0 (via jquery struts 2 plugin) and jQuery layout plugin. The previous answer doesn't work for me. Only the function resizeGrid was a problem though. Just replace the resizeGrid function above with this. This will only resize one grid - the one whose id is gridtable.

    function resizeGrid(pane, $Pane, paneState) {
        jQuery("#gridtable").jqGrid('setGridWidth',paneState.innerWidth - 2, 'true');
    };
    

    #gridtable is the id of the table element you create for jqgrid

    Also, if you are using the jquery struts2 plugin, the grid is automatically generated using < script > blocks within the < body > (not in script blocks within < head >). So, if you called layout() and set triggerEventsOnLoad: true in < head >, you get a javascript error. To avoid this, you can add this script block somewhere after your grid(s) is declared.

    
    

    If you have more than one grid, you can access them using a class you have defined on the table element (see html snippet above), and then run the resizeGrid method on each of them.

提交回复
热议问题