var Slick = require("./slick.core");
/***
* Contains basic SlickGrid formatters.
*
* NOTE: These are merely examples. You will most likely need to implement something more
* robust/extensible/localizable/etc. for your use!
*
* @module Formatters
* @namespace Slick
*/
function PercentCompleteFormatter(row, cell, value, columnDef, dataContext) {
if (value == null || value === "") {
return "-";
} else if (value < 50) {
return "" + value + "%";
} else {
return "" + value + "%";
}
}
function PercentCompleteBarFormatter(row, cell, value, columnDef, dataContext) {
if (value == null || value === "") {
return "";
}
var color;
if (value < 30) {
color = "red";
} else if (value < 70) {
color = "silver";
} else {
color = "green";
}
return "";
}
function YesNoFormatter(row, cell, value, columnDef, dataContext) {
return value ? "Yes" : "No";
}
function CheckboxFormatter(row, cell, value, columnDef, dataContext) {
return '
';
}
function CheckmarkFormatter(row, cell, value, columnDef, dataContext) {
return value ? "
" : "";
}
module.exports = {
Formatters: {
PercentComplete: PercentCompleteFormatter,
PercentCompleteBar: PercentCompleteBarFormatter,
YesNo: YesNoFormatter,
Checkmark: CheckmarkFormatter,
Checkbox: CheckboxFormatter
}
};