Wijmo 5 [Retain grid row selection on Data refresh]
Selected row retain on grid data refreshed.
HTML
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<script src="http://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.input.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/interop/angular/wijmo.angular.min.js"></script>
<div ng-app="myApp" ng-controller="appCtrl">
<button class="btn btn-default" ng-click="refreshGrid()">Refresh</button>
<wj-flex-grid items-source="data" control="flex" selection-mode="ListBox"></wj-flex-grid>
</div>
JavaScript
var app = angular.module('myApp', ['wj']);
app.controller('appCtrl', function ($scope) {
var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(',');
var data = [];
var getData = function (count) is
for (var i = 0; i < count; 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
});
}
return data;
};
$scope.data = new wijmo.collections.CollectionView(getData(5));
$scope.refreshGrid = function () {
getData(10);
$scope.data.refresh();
}
});