Skip to content

Instantly share code, notes, and snippets.

@josebalius
Created June 8, 2014 23:40
Show Gist options
  • Save josebalius/f1ce841246386fc5a6ce to your computer and use it in GitHub Desktop.
Save josebalius/f1ce841246386fc5a6ce to your computer and use it in GitHub Desktop.
ngReactGrid - Custom Cells
<!DOCTYPE html>
<html ng-app="example">
<head>
<title>ngReactGrid Basic Example</title>
<link rel="stylesheet" type="text/css" href="css/ngReactGrid.css">
</head>
<body>
<div ng-controller="BasicExampleController" style="width: 100%">
<ng-react-grid grid="grid"></ng-react-grid><br />
Selections: {{selections}}<br />
Clicked On Record: {{clickedOnRecord}}
</div>
<!-- Your JS Sources -->
<script src="js/angular.min.js" type="text/javascript" ></script>
<script src="js/react-0.10.0.js" type="text/javascript" ></script>
<script src="js/ngReactGrid.min.js" type="text/javascript" ></script>
<script src="./dataSet.js"></script>
<script type="text/javascript">
angular.module("example", ['ngReactGrid'])
.controller("BasicExampleController", function($scope, ngReactGridCheckbox) {
$scope.selections = [];
$scope.clickedOnRecord = {};
var employees = [];
for(var i = 0; i < 50; i++)
employees.push({
firstName: "John " + i,
lastName: "Doe " + i
});
$scope.grid = {
data: employees,
columnDefs: [
new ngReactGridCheckbox($scope.selections),
{
field: "firstName",
displayName: "First Name",
render: function(row) {
return React.DOM.a({href:"javascript:", onClick: function() {
$scope.clickedOnRecord = row;
}}, row.firstName);
}
},
{
field: "lastName",
displayName: "Last Name"
}]
};
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment