chg: [genericElements:indexTable] Added option in toggle field to skip full index reload
parent
0347d7dfda
commit
dddc7d1a12
|
@ -35,7 +35,8 @@ echo $this->element('genericElements/IndexTable/index_table', [
|
|||
'function' => function($row, $options) {
|
||||
return true;
|
||||
}
|
||||
]
|
||||
],
|
||||
'skip_full_reload' => true
|
||||
]
|
||||
],
|
||||
[
|
||||
|
|
|
@ -78,9 +78,15 @@
|
|||
})
|
||||
|
||||
function submitForm(api, url) {
|
||||
const reloadUrl = '<?= isset($field['toggle_data']['reload_url']) ? $field['toggle_data']['reload_url'] : $this->Url->build(['action' => 'index']) ?>'
|
||||
return api.fetchAndPostForm(url, {})
|
||||
.then(() => {
|
||||
UI.reload('/meta-templates', $('#table-container-<?= $tableRandomValue ?>'), $('#table-container-<?= $tableRandomValue ?> table.table'))
|
||||
<?php if (!empty($field['toggle_data']['skip_full_reload'])): ?>
|
||||
const isChecked = $('#<?= $checkboxId ?>').prop('checked')
|
||||
$('#<?= $checkboxId ?>').prop('checked', !$('#<?= $checkboxId ?>').prop('checked'))
|
||||
<?php else: ?>
|
||||
UI.reload(reloadUrl, $('#table-container-<?= $tableRandomValue ?>'), $('#table-container-<?= $tableRandomValue ?> table.table'))
|
||||
<?php endif; ?>
|
||||
})
|
||||
}
|
||||
}())
|
||||
|
|
Loading…
Reference in New Issue