gpt4 book ai didi

Tablesorter在排序后重新添加已删除的行

转载 作者:行者123 更新时间:2023-12-01 11:01:32 24 4
gpt4 key购买 nike

我正在使用 jquery Tablesorter 插件,当我删除一行然后对列进行排序时,删除的行再次出现。从我在stackoverflow上读到的内容是,我可能需要添加trigger.update和/或trigger.appendcache,但这似乎不起作用,我可能把它放在错误的地方。有任何想法吗?

<script type="text/javascript">
$(function () {
$(".tablesorter").tablesorter({
headers: { 0: { sorter: false }, 1: { sorter: false }, 2: { sorter: false }, 3: { sorter: false} },
widgets: ['zebra'],
widgetZebra: { css: ['alt-even-class', 'alt-odd-class'] }
});

$('div#deleteDialog').dialog({
autoOpen: false,
width: 400,
height: 200,
modal: true,
position: 'center',
resizable: false,
buttons: {
OK: function () {
var delID = $('div#deleteDialog input').val();
$.post('@Url.Action("Delete", "Plate")', { id: delID }, function (data) {
if (data === 'delete') {
$('tr#' + delID).remove();
resetGrid();
}
});
$(this).dialog('close');
},
Cancel: function () {
$(this).dialog('close');
}
}
});

$('table.tablesorter thead input:checkbox').change(function () {
$('table.tablesorter tbody input:checkbox').attr('checked', $('table.tablesorter thead input:checkbox').attr('checked'));
});

$('#create').click(function () {
document.location.href = '@Url.Action("ItemSelect", "Plate")';
});

$('.menucosting_view').click(function () {
document.location.href = '@Url.Action("Details", "Plate")' + '/' + $(this).parent().parent().attr('id');
});

$('.menucosting_edit').click(function () {
document.location.href = '@Url.Action("Edit", "Plate")' + '/' + $(this).parent().parent().attr('id');
});

$('.menucosting_delete').click(function () {
$('div#deleteDialog input').val($(this).parent().parent().attr('id'));
$('div#deleteDialog').dialog('open');
});
});

function resetGrid() {
$('.tablesorter tr').removeClass('alt-even-class').removeClass('alt-odd-class');
$('.tablesorter tr:even').addClass('alt-even-class');
$('.tablesorter tr:odd').addClass('alt-odd-class');
}

最佳答案

地点 $('.tablesorter').trigger('update');resetGrid(); !

关于Tablesorter在排序后重新添加已删除的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10303070/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com