File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 3
3
4
4
A higher order React component for [ Sortable] ( https://github.com/RubaXa/Sortable ) .
5
5
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
7
8
8
9
The sample code can be found in the [ examples] ( https://github.com/cheton/react-sortable/tree/master/examples ) directory.
9
10
@@ -116,15 +117,24 @@ import Sortable from 'react-sortablejs';
116
117
117
118
class MySortableList extends React .Component {
118
119
static propTypes = {
120
+ sortableInstance: React .PropTypes .object ,
119
121
items: React .PropTypes .array
120
122
};
121
123
static defaultProps = {
124
+ sortableInstance: null
122
125
items: []
123
126
};
124
127
state = {
125
128
items: this .props .items
126
129
};
127
130
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
+ }
128
138
handleStart (evt ) { // Dragging started
129
139
}
130
140
handleEnd (evt ) { // Dragging ended
You can’t perform that action at this time.
0 commit comments