cells: function (row, col, prop) {
var cellProperties = {};
var rpn1 = '';
var rpn2 = '';
var rpn3 = '';
var max_rpn = [];
var uniqueNames = [];
var sev_from_db = [];
//Part A Start
if ($scope.Bind_Fmea_Data_for_Update.length > 0) {
for (var i = 0; i < $scope.Bind_Fmea_Data_for_Update.length; i++) {
if ($scope.Bind_Fmea_Data_for_Update[i].RPN != undefined) {
if ($scope.Bind_Fmea_Data_for_Update[i].ssev == '9') {
sev_from_db.push($scope.Bind_Fmea_Data_for_Update[i].ssev);
}
else {
rpn_from_db.push($scope.Bind_Fmea_Data_for_Update[i].RPN);
}
}
}
}
if (sort.length == 0 && rpn_from_db.length > 0) {
$.each(rpn_from_db, function (i, el) {
if ($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
});
}
else {
$.each(sort, function (i, el) {
if ($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
});
}
//Part A End
//Part B Start
//add from add fmea
var temp_ssev = this.instance.getDataAtRowProp(row, 'ssev');
var temp_rpn = this.instance.getDataAtRowProp(row, 'RPN');
if ((prop === 'planm' || prop === 'respo' || prop === 'target_completion_date')) {
var maxSsev = [];
for (var i = 0; i < $scope.Bind_Fmea_Data_for_Update.length; i++) {
maxSsev.push(parseInt($scope.Bind_Fmea_Data_for_Update[i].ssev ? $scope.Bind_Fmea_Data_for_Update[i].ssev : 0));
}
console.log("Array max " + parseInt(Math.max.apply(Math, maxSsev)));
var finalMax = parseInt(Math.max.apply(Math, maxSsev));
if (finalMax >= 9 && (prop === 'planm' || prop === 'respo' || prop === 'target_completion_date') && parseInt(temp_ssev) >= 9) {
cellProperties.renderer = colorchange_one;
}
else if (finalMax <= 8 && (prop === 'planm' || prop === 'respo' || prop === 'target_completion_date') && parseInt(temp_ssev) < 9 && uniqueNames.length != 0) {
uniqueNames = [];
for (var i = 0; i < $scope.Bind_Fmea_Data_for_Update.length; i++) {
max_rpn.push(parseInt($scope.Bind_Fmea_Data_for_Update[i].RPN ? $scope.Bind_Fmea_Data_for_Update[i].RPN : 0));
}
$.each(max_rpn, function (i, el) {
if ($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
});
uniqueNames = removeElementsWithValue(uniqueNames, '0');
uniqueNames = removeElementsWithValue(uniqueNames, '');
uniqueNames = uniqueNames.sort(function (a, b) { return b - a });
var num = 0;
if (uniqueNames[2]) {
num = uniqueNames[2]
} else if (uniqueNames[1]) {
num = uniqueNames[1];
}
else if (uniqueNames[0]) {
num = uniqueNames[0];
}
if (parseInt(temp_rpn) >= parseInt(num)) {
cellProperties.renderer = colorchange_one;
} else if (parseInt(temp_rpn) < parseInt(num)) {
cellProperties.renderer = blanck_one;
}
}//..End else if
else {
cellProperties.renderer = blanck_one;
}
}//End If loop
//Part B End
return cellProperties;
}
For Better Understanding I Have Added Part A And Part B in the Coding Section.
If i Comment Part A and Leave Part B No Issue The Data Binds Perfectly But Color Coding what i’m trying to do is not working.
If i Comment Part B and Leave Part A Issue in binding the data(Not Responding State/the Browser will hang)
This Section i’m using to highlight if a particular condition is not meet in Handsontable’s particular columns cell value.
Plz Let me know if i’m doing something wrong here…