Wijmo 5 [Flex Grid]
Highlight edited cell manually/pasted data using itemformatter with Frozen Columns by adding css class
by Joel Parks
HTML
<link rel="stylesheet" href="http://cdn.wijmo.com/5.20172.334/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.20172.334/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.20172.334/controls/wijmo.input.min.js"></script>
<script src="http://cdn.wijmo.com/5.20172.334/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.20172.334/interop/angular/wijmo.angular.min.js"></script>
<div ng-app="app" ng-controller="appCtrl" >
<wj-flex-grid items-source="data"frozen-columns="3" initialized="init(s,e)">
</wj-flex-grid>
</div>
CSS
.wj-edit:not(.wj-state-selected):not(.wj-state-multi-selected){
background-color:lightcoral!important;
}
.wj-flexgrid{
max-height:200px;
}
JavaScript
var app = angular.module('app', ['wj']);
// app controller provides data
app.controller('appCtrl', function appCtrl($scope) {
// generate some random data
var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
data = [];
for (var i = 0; i < 50; i++) {
data.push({
id: i,
country: countries[i % countries.length],
date: new Date(2014, i % 12, i % 28),
amount: Math.random() * 10000,
active: i % 4 == 0,
id1: i,
country1: countries[i % countries.length],
date1: new Date(2014, i % 12, i % 28),
amount1: Math.random() * 10000,
active1: i % 4 == 0,
id2: i,
country2: countries[i % countries.length],
date2: new Date(2014, i % 12, i % 28),
amount2: Math.random() * 10000,
active2: i % 4 == 0,
id3: i,
country3: countries[i % countries.length],
date3: new Date(2014, i % 12, i % 28),
amount3: Math.random() * 10000,
active3: i % 4 == 0
});
}
// add data array to scope
$scope.data = data;
$scope.init = function(s, e) {
s.cellEditEnding.addHandler(function (s, e) {
setChanged(e.row, e.col);
});
s.pastedCell.addHandler(function (s, e) {
setChanged(e.row, e.col);
});
s.itemFormatter = function (panel, r, c, cell) {
if (panel.cellType == wijmo.grid.CellType.Cell) {
if (getChanged(r, c)) {
cell.classList.add("wj-edit");
}
...