jQuery EasyUI extended - data grid row drop
jQuery EasyUI Extended
usage
It contains 'datagrid-dnd.js' file
<Script type = "text / javascript" src = "datagrid-dnd.js"> </ script>
Enable dragging and placing
<Table class = "easyui-datagrid" title = "DataGrid" style = "width: 700px; height: 250px" data-options = " singleSelect: true, data: data, onLoadSuccess: function () { $ (This) .datagrid ( 'enableDnd'); } "> <Thead> <Tr> <Th data-options = "field: 'itemid', width: 80"> Item ID </ th> <Th data-options = "field: 'productid', width: 100"> Product </ th> <Th data-options = "field: 'listprice', width: 80, align: 'right'"> List Price </ th> <Th data-options = "field: 'unitcost', width: 80, align: 'right'"> Unit Cost </ th> <Th data-options = "field: 'attr1', width: 250"> Attribute </ th> <Th data-options = "field: 'status', width: 60, align: 'center'"> Status </ th> </ Tr> </ Thead> </ Table>
event
The event extended from the data grid (datagrid), the following are events for the data grid (datagrid) added.
名称 | 参数 | 描述 |
---|---|---|
onBeforeDrag | row | 当一行的拖拽开始前触发,返回 false 则取消拖拽。 |
onStartDrag | row | 当开始拖拽一行时触发。 |
onStopDrag | row | 当停止拖拽一行后触发。 |
onDragEnter | targetRow, sourceRow | 当拖拽一行进入某允许放置的目标行时触发,返回 false 则取消放置。 |
onDragOver | targetRow, sourceRow | 当拖拽一行在某允许放置的目标行上时触发,返回 false 则取消放置。 |
onDragLeave | targetRow, sourceRow | 当拖拽一行离开某允许放置的目标行时触发。 |
onBeforeDrop | targetRow,sourceRow,point |
当一行被放置前触发,返回 false 则取消放置。 targetRow:放置的目标行。 sourceRow:拖拽的源行。 point:指示放置的位置,可能的值:'top' 或 'bottom'。 |
onDrop | targetRow,sourceRow,point |
当一行被放置时触发。 targetRow:放置的目标行。 sourceRow:拖拽的源行。 point:指示放置的位置,可能的值:'top' 或 'bottom'。 |
method
The methods extend from the data grid (datagrid).
名称 | 参数 | 描述 |
---|---|---|
enableDnd | index |
启用行的拖拽与放置。 'index' 参数指示要被拖拽与放置的行。 如果该参数未指定,则拖拽与放置所有行。 代码实例: $('#dg').datagrid('enableDnd', 1); // enable dragging on second row $('#dg').datagrid('enableDnd'); // enable dragging all rows |
Download jQuery EasyUI examples
jquery-easyui-datagrid-dnd.zip
jQuery EasyUI Extended