Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add className option to groupHeaders and manage array as select edit/filter options #508

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions dist/modules/grid.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,16 @@
isNoFilterValueExist = true;
}
}
} else if (Array.isArray(value)) {
for (i = 0 ; i < value.length ; i++) {
optionInfos.push({
value: value[i][0],
innerHtml: value[i][1],
selectValue: $.trim(value[i][0]),
selectText: $.trim(value[i][1]),
selected: false
});
}
} else if (typeof value === "object") {
for (key in value) {
if (value.hasOwnProperty(key)) {
Expand Down
1 change: 1 addition & 0 deletions dist/modules/grid.custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,7 @@
// The text will be over the cVisibleColumns columns
$colHeader = $("<th>")
.addClass(thClasses)
.addClass(cghi.className)
.html(titleText || "&nbsp;");
if (cVisibleColumns > 0) {
$colHeader.attr("colspan", String(cVisibleColumns));
Expand Down
10 changes: 10 additions & 0 deletions js/grid.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,16 @@
isNoFilterValueExist = true;
}
}
} else if (Array.isArray(value)) {
for (i = 0 ; i < value.length ; i++) {
optionInfos.push({
value: value[i][0],
innerHtml: value[i][1],
selectValue: $.trim(value[i][0]),
selectText: $.trim(value[i][1]),
selected: false
});
}
} else if (typeof value === "object") {
for (key in value) {
if (value.hasOwnProperty(key)) {
Expand Down
15 changes: 15 additions & 0 deletions js/grid.custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,7 @@
var $t = this, i, l, $th, $resizing, grid = $t.grid, cm = $t.p.colModel, hc,
thead = $("table.ui-jqgrid-htable thead", grid.hDiv);
if (!grid) { return; }
delete this.grid.groupHeaders;

$($t).off(".setGroupHeaders");
var $tr = $("<tr>", { role: "row" }).addClass("ui-jqgrid-labels");
Expand Down Expand Up @@ -1294,6 +1295,7 @@

$(ts).prepend($thead);
$tr = $("<tr>", { role: "row" }).addClass("ui-jqgrid-labels jqg-third-row-header");
this.grid.groupHeaders = [];
for (i = 0; i < cml; i++) {
th = ths[i].el;
$th = $(th);
Expand Down Expand Up @@ -1322,6 +1324,7 @@
// The text will be over the cVisibleColumns columns
$colHeader = $("<th>")
.addClass(thClasses)
.addClass(cghi.className)
.html(titleText || "&nbsp;");
if (cVisibleColumns > 0) {
$colHeader.attr("colspan", String(cVisibleColumns));
Expand All @@ -1336,6 +1339,12 @@

$th.before($colHeader); // insert new column header before the current
$tr.append(th); // move the current header in the next row
this.grid.groupHeaders.push({
el: $colHeader[0],
numberOfColumns: cghi.numberOfColumns,
numberOfVisibleColumns: cVisibleColumns,
title: cghi.titleText
});

// set the counter of headers which will be moved in the next row
skip = numberOfColumns - 1;
Expand All @@ -1356,6 +1365,12 @@
$tr.append(th);
skip--;
}
this.grid.groupHeaders.push({
el: th,
numberOfColumns: 1,
numberOfVisibleColumns: 0,
title: ''
});
}
}
$theadInTable = $(ts).children("thead");
Expand Down