Skip to content

Commit

Permalink
Add support for group heasder when frozen columns only when useColSpa…
Browse files Browse the repository at this point in the history
…nStyle is false. Fiz sorting when frozen and group header
  • Loading branch information
tonytomov committed Dec 3, 2011
1 parent ae664f8 commit 3c28637
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions js/grid.custom.js
Expand Up @@ -653,10 +653,33 @@ $.jgrid.extend({
$t.grid.fbDiv = $('<div style="position:absolute;left:0px;top:'+(parseInt(top,10)+parseInt(hth,10) + 1)+'px;overflow-y:hidden" class="frozen-bdiv ui-jqgrid-bdiv"></div>');
$("#gview_"+$.jgrid.jqID($t.p.id)).append($t.grid.fhDiv);
var htbl = $(".ui-jqgrid-htable","#gview_"+$.jgrid.jqID($t.p.id)).clone(true);
$("tr",htbl).each(function(){
// TODO groupheader support
$("th:gt("+maxfrozen+")",this).remove();
})
// groupheader support - only if useColSpanstyle is false
if($t.p.groupHeader) {
$("tr.jqg-first-row-header, tr.jqg-third-row-header", htbl).each(function(){
$("th:gt("+maxfrozen+")",this).remove();
});
var swapfroz = -1, fdel = -1;
$("tr.jqg-second-row-header th", htbl).each(function( i ){
var cs= parseInt($(this).attr("colspan"),10);
if(cs) {
swapfroz = swapfroz+cs;
fdel++;
}
if(swapfroz === maxfrozen) {
return false;
}
});
if(swapfroz !== maxfrozen) {
fdel = maxfrozen;
}
$("tr.jqg-second-row-header", htbl).each(function( i ){
$("th:gt("+fdel+")",this).remove();
});
} else {
$("tr",htbl).each(function(){
$("th:gt("+maxfrozen+")",this).remove();
});
}
$(htbl).width(1);
// resizing stuff
$($t.grid.fhDiv).append(htbl)
Expand All @@ -671,7 +694,7 @@ $.jgrid.extend({
var rhth = $(".ui-jqgrid-htable",$t.grid.fhDiv);
$("th:eq("+index+")",rhth).width( w );
var btd = $(".ui-jqgrid-btable",$t.grid.fbDiv);
$("td:eq("+index+")",btd).width( w );
$("tr:first td:eq("+index+")",btd).width( w );

if ($.isFunction($t.p.orgEvents.resizeStop)) {
$t.p.orgEvents.resizeStop.call($t, w, index);
Expand All @@ -687,7 +710,7 @@ $.jgrid.extend({
}
$t.p.onSortCol = function( index,idxcol,so ){

var previousSelectedTh = $("th:eq("+$t.p.lastsort+")",$t.grid.fhDiv), newSelectedTh = $("th:eq("+idxcol+")",$t.grid.fhDiv);
var previousSelectedTh = $("tr.ui-jqgrid-labels:last th:eq("+$t.p.lastsort+")",$t.grid.fhDiv), newSelectedTh = $("tr.ui-jqgrid-labels:last th:eq("+idxcol+")",$t.grid.fhDiv);

$("span.ui-grid-ico-sort",previousSelectedTh).addClass('ui-state-disabled');
$(previousSelectedTh).attr("aria-selected","false");
Expand Down

0 comments on commit 3c28637

Please sign in to comment.