Skip to content

Commit 6d28050

Browse files
committed
Merge branch 'dev' of github.com:cheton/react-sortable into dev
2 parents ff50b5f + 6619a48 commit 6d28050

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
A higher order React component for [Sortable](https://github.com/RubaXa/Sortable).
55

6-
Demo: http://cheton.github.io/react-sortable
6+
- Demo: http://cheton.github.io/react-sortable
7+
- Live Coding at WebpackBin: http://www.webpackbin.com/VJe8dfMpe
78

89
The sample code can be found in the [examples](https://github.com/cheton/react-sortable/tree/master/examples) directory.
910

@@ -116,15 +117,24 @@ import Sortable from 'react-sortablejs';
116117

117118
class MySortableList extends React.Component {
118119
static propTypes = {
120+
sortableInstance: React.PropTypes.object,
119121
items: React.PropTypes.array
120122
};
121123
static defaultProps = {
124+
sortableInstance: null
122125
items: []
123126
};
124127
state = {
125128
items: this.props.items
126129
};
127130

131+
componentDidUpdate() {
132+
// Note: The sortableInstance is null for the initial render
133+
const { sortableInstance } = this.props;
134+
135+
// You can see all the methods at https://github.com/RubaXa/Sortable#method
136+
console.log(sortableInstance.toArray());
137+
}
128138
handleStart(evt) { // Dragging started
129139
}
130140
handleEnd(evt) { // Dragging ended

0 commit comments

Comments
 (0)