danielstocks/react-sortable

html tables support

degr opened this issue · 5 comments

degr commented

Not work in case of use with 'th', 'td', 'tr' tags, because 'div' can't be used inside of any 'table', 'tbody', 'tr' tags. So, when you wrap your component with <div className={this.isDragging() ? draggingClassName : ""}> it fail.

Taking look at this one.

degr commented

I implement dnd for my tables by self (it take around 50 rows of code, with html5 dnd attributes). So, I will no check it. But anyway, thanks.

Alright, you would be also very much welcomed to make a PR into this repository.

degr commented

In your case better do this:

export function SortableComposition(Component, wrapperTagName) {
...
return ( React.createElement(wrapperTagName || 'div', {className:this.isDragging() ? draggingClassName : "}, <Component {...this.props} ...

Using this trick this component will be more scalable, and you will be able to use it inside of
table, dl, li, ul, span and other non-block tags