Wijmo 5 [Flex Grid]
Highlight edited cell manually/pasted data
HTML
<link rel="stylesheet" href="http://cdn.wijmo.com/5.20162.188/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.20162.188/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.20162.188/controls/wijmo.input.min.js"></script>
<script src="http://cdn.wijmo.com/5.20162.188/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.20162.188/interop/angular/wijmo.angular.min.js"></script>
<div ng-app="app" ng-controller="appCtrl" >
<wj-flex-grid is-read-only="true" items-source="data" initialized="init(s,e)">
</wj-flex-grid>
</div>
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 < 5; i++) {
data.push({
id: i,
country: countries[i % countries.length],
date: new Date(2014, i % 12, i % 28),
amount: null,
active: i % 4 == 0
});
}
// add data array to scope
$scope.data = data;
$scope.init = function(s, e) {
s.cellEditEnded.addHandler(function (s, e) {
//setChanged(e.row, e.col);
e.cancel = true;
});
s.pastedCell.addHandler(function (s, e) {
setChanged(e.row, e.col);
});
s.updatedView.addHandler(function (s, e) {
for (var i = 0; i < changes.length; i++) {
var arg = changes[i];
getGridCell(arg.r, arg.c);
}
});
// get a grid cell from the row/col indices
function getGridCell(r, c) {
var grid = s;
// find the cell from its bounding rectangle
var rc = grid.getCellBoundingRect(r, c);
var cell = document.elementFromPoint(rc.left + rc.width / 2, rc.top + rc.height / 2);
// make sure this is a regular cell (not a header)
if (wijmo.hasClass(cell, 'wj-header')) {
cell = null;
}
// make sure this is not an element within a cell
while (cell && !wijmo.hasClass(cell,...