日期:2014-05-16 浏览次数:20458 次
function move(isUp) {
var selections = dt.datagrid("getSelections");
if(selections.length == 0){
return;
}
if(selections.length > 1){
$.message.show("一次只能移动一条数据。","warning",2);
return;
}
var $view = $('div.datagrid-view');
var index = dt.datagrid('getRowIndex',selections[0]);
var $row = $view.find('tr[datagrid-row-index=' + index + ']');
if (isUp) {
$row.each(function(){
var prev = $(this).prev();
prev.length && $(this).insertBefore(prev);
});
} else {
$row.each(function(){
var next = $(this).next();
next.length && $(this).insertAfter(next);
});
}
}