SlickGrid with AngularJS Directive
This example demonstrates the integration of SlickGrid with AngularJS Directive
HTML
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/redmond/jquery-ui.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js"></script>
<script src="https://rawgithub.com/Celebio/SlickGrid/master/lib/jquery.event.drag-2.2.js"></script>
<script src="https://rawgithub.com/Celebio/SlickGrid/master/slick.core.js"></script>
<script src="https://rawgithub.com/Celebio/SlickGrid/master/slick.grid.js"></script>
<link rel="stylesheet" href="https://rawgithub.com/Celebio/SlickGrid/master/slick.grid.css">
<link rel="stylesheet" href="https://rawgithub.com/Celebio/SlickGrid/master/slick-default-theme.css">
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<div ng-app="slickGridApp">
<div s-grid style="width:600px;height:500px;"></div>
</div>
<script type='text/javascript'>
angular.module('slickGridApp', [])
.directive('sGrid', [function () {
return {
restrict: 'EA',
link : function(scope, element, attrs){
var columns = [
{id: "title", name: "Title", field: "title"},
{id: "duration", name: "Duration", field: "duration"},
{id: "%", name: "% Complete", field: "percentComplete"},
{id: "start", name: "Start", field: "start"},
{id: "finish", name: "Finish", field: "finish"},
{id: "effort-driven", name: "Effort Driven", field: "effortDriven"}
];
var options = {
enableCellNavigation: true,
enableColumnReorder: true
};
var data = [];
for (var i = 0; i < 50000; i++) {
var d = (data[i] = {});
d["id"] = "id_" + i;
d["num"] = i;
d["title"] = "Task " + i;
d["duration"] = "5 days";
d["percentComplete"] = Math.round(Math.random()...
CSS
.ng-invalid {
border: 1px solid red;
}
body {
font-family: Arial, Helvetica, sans-serif;
}
body,td,th {
font-size: 14px;
margin: 0;
}
table {
border-collapse: separate;
border-spacing: 2px;
display: table;
margin-bottom: 0;
margin-top: 0;
-moz-box-sizing: border-box;
text-indent: 0;
}
a:link,a:visited,a:hover {
color: #5D6DB6;
text-decoration: none;
}
.error {
color: red;
}
.ui-helper-hidden {
display: none;
}