Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The implementation of frozen columns in jqGrid are based on creating of two additional divs with absolute position <em>over</em> the standard grid. If the height of all column headers and all rows of the grid's body are the same the frozen columns works good, but in case of variable height (usage of <code>height: auto</code> CSS) one have the following results (see <a href="http://WrappedTextAndFrozenColumns0.htm" rel="nofollow noreferrer">the first demo</a>):</p> <p><img src="https://i.stack.imgur.com/rF6Tr.png" alt="enter image description here"></p> <p>The first div, so named <code>fhDiv</code>, which I marked with yellow color contains the copy of the column header (the <code>hDiv</code>) where the last non-frozen columns are removed. In the same way the second div, so named <code>fbDiv</code>, which I marked with red color contains the copy of the grid body (the <code>bDiv</code>) where the last non-frozen columns are removed. You can read <a href="https://stackoverflow.com/a/3463002/315935">here</a> more about the standard grid elements.</p> <p>In the demo I used character wrapping in the column headers which I described in <a href="https://stackoverflow.com/a/7256972/315935">the answer</a> and the word wrapping described for example <a href="https://stackoverflow.com/a/3006134/315935">here</a>.</p> <p>The height of every row of the <code>fhDiv</code> or <code>fbDiv</code> will be calculated independent from the height of non-frozen columns. So the height of the rows can be less as required.</p> <p>It is difficult to suggest perfect solution of the problem, but it seems that I found good enough pragmatical way. The idea is to set the height of every row from the <code>fhDiv</code> and <code>fbDiv</code> explicitly based on the size of the corresponding row in the main dives <code>hDiv</code> and <code>bDiv</code>. So I extended the code of <code>fixPositionsOfFrozenDivs</code> function described in <a href="https://stackoverflow.com/a/8620574/315935">the answer</a> to the following:</p> <pre><code>var fixPositionsOfFrozenDivs = function () { var $rows; if (typeof this.grid.fbDiv !== "undefined") { $rows = $('&gt;div&gt;table.ui-jqgrid-btable&gt;tbody&gt;tr', this.grid.bDiv); $('&gt;table.ui-jqgrid-btable&gt;tbody&gt;tr', this.grid.fbDiv).each(function (i) { var rowHight = $($rows[i]).height(), rowHightFrozen = $(this).height(); if ($(this).hasClass("jqgrow")) { $(this).height(rowHight); rowHightFrozen = $(this).height(); if (rowHight !== rowHightFrozen) { $(this).height(rowHight + (rowHight - rowHightFrozen)); } } }); $(this.grid.fbDiv).height(this.grid.bDiv.clientHeight); $(this.grid.fbDiv).css($(this.grid.bDiv).position()); } if (typeof this.grid.fhDiv !== "undefined") { $rows = $('&gt;div&gt;table.ui-jqgrid-htable&gt;thead&gt;tr', this.grid.hDiv); $('&gt;table.ui-jqgrid-htable&gt;thead&gt;tr', this.grid.fhDiv).each(function (i) { var rowHight = $($rows[i]).height(), rowHightFrozen = $(this).height(); $(this).height(rowHight); rowHightFrozen = $(this).height(); if (rowHight !== rowHightFrozen) { $(this).height(rowHight + (rowHight - rowHightFrozen)); } }); $(this.grid.fhDiv).height(this.grid.hDiv.clientHeight); $(this.grid.fhDiv).css($(this.grid.hDiv).position()); } }; </code></pre> <p>I called the method inside of <code>resizeStop</code> and <code>loadComplete</code> callbacks. In case of usage of <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods#resizable_grid" rel="nofollow noreferrer">gridResize</a> method one need include additional fixes inside of <a href="http://docs.jquery.com/UI/API/1.8/Resizable#event-stop" rel="nofollow noreferrer">stop</a> handler.</p> <p>The full my suggestions you can see on <a href="http://www.ok-soft-gmbh.com/jqGrid/WrappedTextAndFrozenColumns.htm" rel="nofollow noreferrer">the demo</a> which fixs the results from the first demo to the following:</p> <p><img src="https://i.stack.imgur.com/zmVSu.png" alt="enter image description here"></p> <p><strong>UPDATED</strong>: <a href="https://stackoverflow.com/a/16517257/315935">The answer</a> contains updated version of the demo: <a href="http://www.ok-soft-gmbh.com/jqGrid/WrappedTextAndFrozenColumns2.htm" rel="nofollow noreferrer">this one</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload