gigaZhang / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

How to set width of column in grid Dynamically... #933

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i am facing problem to set the width of column dynamically...i m not able to 
get event of width column when i took cursor there...

so please help to solve this problem and set to width dynamically or from 
database..

What is the expected output? What do you see instead?
set width from database or Dynamically

Which struts2 version?
2.3

Which struts2-jquery plugin version?
3.3.3

Original issue reported on code.google.com by pramod1...@gmail.com on 26 Dec 2012 at 9:02

Attachments:

GoogleCodeExporter commented 9 years ago
jqGrid does not support an automatic resizing. I use following workaround:

<div id="content">
  <sjg:grid id="mygrid" ... >
    <!-- The Grid Columns -->
  </sjg:grid />
</div>

<script type="text/javascript">
$(document).ready(function() {
jQuery(window).bind('resize', function() {

    // Get width of parent container
    var width = jQuery("#content").width();
    width = width-35; // Fudge factor to prevent horizontal scrollbars

    if (width > 0 &&
        // Only resize if new width exceeds a minimal threshold
        // Fixes IE issue with in-place resizing when mousing-over frame bars
        Math.abs(width - jQuery("#mygrid").width()) > 5)
    {
        jQuery("#mygrid").jqGrid('setGridWidth', width-40, true);
    }

}).trigger('resize');
});
</script>

Original comment by johgep on 13 Jan 2013 at 10:02