mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Relabel var_idx after reordering extra keys
This commit is contained in:
parent
4155f9fe9c
commit
e5ea2e5a6d
2 changed files with 9 additions and 2 deletions
|
|
@ -129,7 +129,7 @@
|
|||
<td>
|
||||
<div class="wrap" style="user-select:none">
|
||||
<button type="button" class="dragBtn">Move to</button>
|
||||
{$val->idx}
|
||||
<span class="var_idx">{$val->idx}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>{$val->eid}</td>
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
// Reorder extra keys
|
||||
$('table.extra_keys.sortable').on('after-drag.st', function(e) {
|
||||
const $table = $(this);
|
||||
let order = [];
|
||||
let i = 1;
|
||||
$(this).find('tbody > tr').each(function() {
|
||||
$table.find('tbody > tr').each(function() {
|
||||
order.push({
|
||||
eid: $(this).data('eid'),
|
||||
old_idx: parseInt($(this).data('idx'), 10),
|
||||
|
|
@ -15,6 +16,12 @@
|
|||
Rhymix.ajax('document.procDocumentAdminReorderExtraVars', {
|
||||
module_srl: $(this).data('moduleSrl'),
|
||||
order: order
|
||||
}, function() {
|
||||
let i = 1;
|
||||
$table.find('.var_idx').each(function() {
|
||||
$(this).text(i);
|
||||
i++;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue