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

cssClass can receive a function as a parameter #1083

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
19 changes: 10 additions & 9 deletions slick.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -1452,11 +1452,12 @@ if (typeof Slick === "undefined") {

function appendCellHtml(stringArray, row, cell, colspan, item) {
var m = columns[cell];
var cellCss = "slick-cell l" + cell + " r" + Math.min(columns.length - 1, cell + colspan - 1) +
(m.cssClass ? " " + m.cssClass : "");
if (row === activeRow && cell === activeCell) {
cellCss += (" active");
}
var customCssClass = (typeof (m.cssClass) == 'function' ? m.cssClass(row, cell, item) : m.cssClass) || '';

var cellCss = "slick-cell l" + cell + " r" + Math.min(columns.length - 1, cell + colspan - 1) +' '+ customCssClass;
if (row === activeRow && cell === activeCell) {
cellCss += (" active");
}

// TODO: merge them together in the setter
for (var key in cellCssClasses) {
Expand Down Expand Up @@ -1515,7 +1516,7 @@ if (typeof Slick === "undefined") {
} else {
$canvas[0].removeChild(cacheEntry.rowNode);
}

delete rowsCache[row];
delete postProcessedRows[row];
renderedRows--;
Expand Down Expand Up @@ -2162,7 +2163,7 @@ if (typeof Slick === "undefined") {
$canvas[0].removeChild(zombieRowNodeFromLastMouseWheelEvent);
zombieRowNodeFromLastMouseWheelEvent = null;
}
rowNodeFromLastMouseWheelEvent = rowNode;
rowNodeFromLastMouseWheelEvent = rowNode;
}
}

Expand Down Expand Up @@ -2217,7 +2218,7 @@ if (typeof Slick === "undefined") {
cancelEditAndSetFocus();
} else if (e.which == 34) {
navigatePageDown();
handled = true;
handled = true;
} else if (e.which == 33) {
navigatePageUp();
handled = true;
Expand Down Expand Up @@ -2774,7 +2775,7 @@ if (typeof Slick === "undefined") {
var prevActivePosX = activePosX;
while (cell <= activePosX) {
if (canCellBeActive(row, cell)) {
prevCell = cell;
prevCell = cell;
}
cell += getColspan(row, cell);
}
Expand Down