Skip to content

Commit

Permalink
Merge pull request #572 from ChiefORZ/dev
Browse files Browse the repository at this point in the history
more reliable way to get the DOM Node
  • Loading branch information
RubaXa committed Sep 24, 2015
2 parents fc4a9b3 + fa33718 commit 1065b92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ This gives us the possiblity to test the behaviour for older Browsers even in ne

On top of that, the Fallback always generates a copy of that DOM Element and appends the class `fallbackClass` definied in the options. This behaviour controls the look of this 'dragged' Element.

Demo: http://jsbin.com/xinuyenabi/edit?html,css,js,output
Demo: http://jsbin.com/pucurizace/edit?html,css,js,output


---
Expand Down Expand Up @@ -410,7 +410,7 @@ var AllUsers = React.createClass({
render: function() {
return (
<h1>Users</h1>
<ul ref="users">{
<ul ref="user">{
this.state.users.map(function (text) {
return <li>{text}</li>
})
Expand Down
11 changes: 4 additions & 7 deletions react-sortable-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@
onRemove: 'handleRemove',
onSort: 'handleSort',
onFilter: 'handleFilter',
onMove: 'handleMove',
getContainer: function(component){
/** @namespace this.refs — http://facebook.github.io/react/docs/more-about-refs.html */
return (component.refs[options.ref] || component).getDOMNode()
}
onMove: 'handleMove'
};


Expand Down Expand Up @@ -85,7 +81,7 @@


componentDidMount: function () {
var options = _extend(_extend({}, _defaultOptions), this.sortableOptions || {}),
var DOMNode, options = _extend(_extend({}, _defaultOptions), this.sortableOptions || {}),
copyOptions = _extend({}, options),

emitEvent = function (/** string */type, /** Event */evt) {
Expand Down Expand Up @@ -134,9 +130,10 @@
}.bind(this);
}, this);

DOMNode = this.getDOMNode() ? (this.refs[options.ref] || this).getDOMNode() : this.refs[options.ref] || this;

/** @namespace this.refs — http://facebook.github.io/react/docs/more-about-refs.html */
this._sortableInstance = Sortable.create(copyOptions.getContainer(this), copyOptions);
this._sortableInstance = Sortable.create(DOMNode, copyOptions);
},

componentWillReceiveProps: function (nextProps) {
Expand Down

0 comments on commit 1065b92

Please sign in to comment.