<body ng-controller="PhoneListCtrl">
//button click event here
<button id="btn" ng-click="click()">DataSourcebutton>
<div id="grid" ej-grid e-datasource="data" e-columns="col" e-allowpaging="true" e-toolbarsettings-showtoolbar='true' e-recorddoubleclick="recordDblClick" e-toolbarclick="toolbarHandler" e-toolbarsettings-toolbaritems='toolbar' e-editsettings-allowdeleting=' true' e-editsettings-allowediting='true' e-editsettings-allowadding='true'>div>
<script type="text/javascript">
angular.module('listCtrl', ['ejangular'])
.controller('PhoneListCtrl', function ($scope) {
//old data
$scope.data = window.gridData2;
// data
var obj = [{ "OrderID": 1, "TestColumn": "Davolio", "CustomerID": "Nancy", }, { "OrderID": 1, "TestColumn": "Davolio", "CustomerID": "Nancy", }, { "OrderID": 1, "TestColumn": "Davolio", "CustomerID": "Nancy", }]
$scope.click = function (args) {
//obj data will bind here
$scope.data = obj;
}
$scope.toolbar = ["add", "edit", "delete", "update", "cancel"]
$scope.col = [{ "field": "OrderID", "headerText": "OrderID", "textAlign": "right", "isPrimaryKey": true, "width": 90 },
{ "field": "TestColumn", "headerText": "TestColumn", "width": 90 },
{ "field": "CustomerID", "headerText": "CustomerID", "textAlign": "right", "width": 90 }]
});
script> |