Skip to content

Commit 75abacd

Browse files
committed
- version 0.5.0 custom cell rendering API finished
- ngReactGridCheckbox factory now available for those that need it
1 parent 6bb1fdd commit 75abacd

File tree

10 files changed

+117
-16
lines changed

10 files changed

+117
-16
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ngReactGrid - v0.4.0
1+
ngReactGrid - v0.5.0
22
===========
33

44
ngReactGrid is an Angular directive that can be used to render an enhanced HTML table or grid of data very fast using React as the rendering engine.
@@ -18,11 +18,12 @@ Features
1818
* Search
1919
* Horizontal scrolling
2020
* Custom width / height
21+
* Custom cell rendering
22+
* Checkbox selection column
2123

2224
Todo
2325
----
2426
* Resizeable columns
25-
* Custom cell rendering (already implemented, need to document)
2627
* Column pinning
2728
* Don't see your feature? I am accepting pull requests. Please contribute.
2829

build/js/ngReactGrid-0.4.0.min.js

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license ngReactGrid v0.4.0
2+
* @license ngReactGrid v0.5.0
33
* (c) 2010-2014 Jose Garcia - http://josebalius.github.io/ngReactGrid/
44
* License: MIT
55
*/
@@ -50,6 +50,32 @@ angular.module("ngReactGrid", [])
5050
};
5151
}])
5252

53+
.factory("ngReactGridCheckbox", function() {
54+
var ngReactGridCheckbox = function(selectionTarget) {
55+
return {
56+
field: "",
57+
fieldName: "",
58+
render: function(row) {
59+
60+
var handleClick = function() {
61+
var index = selectionTarget.indexOf(row);
62+
if(index === -1) {
63+
selectionTarget.push(row);
64+
} else {
65+
selectionTarget.splice(index, 1);
66+
}
67+
};
68+
69+
return (ngReactGridCheckboxComponent({selectionTarget: selectionTarget, handleClick: handleClick}));
70+
},
71+
sort: false,
72+
width: 1
73+
}
74+
};
75+
76+
return ngReactGridCheckbox;
77+
})
78+
5379
/**
5480
* @factory ngReactGrid
5581
*/
@@ -494,7 +520,8 @@ var ngReactGridComponent = (function() {
494520
cursor: "pointer",
495521
width: "8%",
496522
"float": "left",
497-
textAlign: "right"
523+
textAlign: "right",
524+
display: (this.props.cell.sort === false) ? "none": ""
498525
};
499526

500527
var arrowStyle = {
@@ -888,4 +915,25 @@ var ngReactGridComponent = (function() {
888915
});
889916

890917
return ngReactGrid;
918+
})();
919+
/** @jsx React.DOM */
920+
var ngReactGridCheckboxComponent = (function() {
921+
var ngReactGridCheckboxComponent = React.createClass({displayName: 'ngReactGridCheckboxComponent',
922+
handleClick: function() {
923+
this.props.handleClick();
924+
},
925+
render: function() {
926+
var checkboxStyle = {
927+
textAlign: "center"
928+
};
929+
930+
return (
931+
React.DOM.div( {style:checkboxStyle},
932+
React.DOM.input( {type:"checkbox", onClick:this.handleClick} )
933+
)
934+
)
935+
}
936+
});
937+
938+
return ngReactGridCheckboxComponent;
891939
})();

0 commit comments

Comments
 (0)