|
|
@@ -68,10 +68,12 @@ const _initialColSetTbodyHtml = $tbody.html();
|
|
|
|
|
|
// 更新上下移链接显示状态
|
|
|
function updateMoveButtons() {
|
|
|
- const $currentRows = $tbody.find('tr');
|
|
|
- const totalRows = $currentRows.length;
|
|
|
+ const $movableRows = $tbody.find('tr').filter(function() {
|
|
|
+ return $(this).find('.move-up, .move-down').length > 0;
|
|
|
+ });
|
|
|
+ const totalRows = $movableRows.length;
|
|
|
|
|
|
- $currentRows.each(function(index) {
|
|
|
+ $movableRows.each(function(index) {
|
|
|
const $row = $(this);
|
|
|
const $upLink = $row.find('.move-up');
|
|
|
const $downLink = $row.find('.move-down');
|
|
|
@@ -114,7 +116,7 @@ $tbody.on('click', '.move-up', function(e) {
|
|
|
const $currentRow = $(this).closest('tr');
|
|
|
const $prevRow = $currentRow.prev('tr');
|
|
|
|
|
|
- if ($prevRow.length) {
|
|
|
+ if ($prevRow.find('.move-up, .move-down').length) {
|
|
|
$currentRow.insertBefore($prevRow);
|
|
|
updateMoveButtons();
|
|
|
}
|
|
|
@@ -125,7 +127,7 @@ $tbody.on('click', '.move-down', function(e) {
|
|
|
const $currentRow = $(this).closest('tr');
|
|
|
const $nextRow = $currentRow.next('tr');
|
|
|
|
|
|
- if ($nextRow.length) {
|
|
|
+ if ($nextRow.find('.move-up, .move-down').length) {
|
|
|
$currentRow.insertAfter($nextRow);
|
|
|
updateMoveButtons();
|
|
|
}
|