1.0.8 • Published 5 years ago

drag-drop-sort v1.0.8

Weekly downloads
11
License
ISC
Repository
github
Last release
5 years ago

DragDropSort

Useage

  • In the react development, an example of the component DragDropSort is referenced:
class Demo extends Component {

  data() {
    return [{
      label: 'button'
    }]
  }

  getReturnData(data) {
    <!-- get the sorted data, return data of type array -->
  }

  render() {
    let items = [];
    this.data.forEach(item => {
      items.push(<button>{item}</button>);
    });

    return <div>
      <DragDropSort data={data} callback={getReturnData} dragTag="button">
        {items}
      </DragDropSort>
    </div>
  }
}

Options

  • You can set the options to drag-drop-sort.
NameTypeDefaultDescription
data{Array}[]the Data used to render lists for sort.
callback{Array}[]Returns sorted data.
dragTag{String}undefinedthe tagName of the specified drag child element.
  • Here's an example webpack config illustrating how to use these options
<DragDropSort data={data} callback={getReturnData} dragTag="button">
  {items}
</DragDropSort>

Remark: The array element needs to contain the label attribute.

Install

npm install drag-drop-sort --save
1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago