mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 00:02:17 +02:00
Added the ability to reload a selection fro a paginated list.
SVN:trunk[1524]
This commit is contained in:
@@ -105,7 +105,7 @@ function sprintf(format, etc) {
|
||||
$(':input[name^=storedSelection]', pager).remove();
|
||||
}
|
||||
|
||||
function updateSelection(table, pager, id, value)
|
||||
function storeSelection(table, pager, id, value)
|
||||
{
|
||||
var valueToStore = value;
|
||||
if (table.config.selectionMode == 'negative')
|
||||
@@ -133,6 +133,12 @@ function sprintf(format, etc) {
|
||||
updateCounter(table, pager);
|
||||
}
|
||||
|
||||
function loadSelection(table, pager)
|
||||
{
|
||||
table.config.selectionMode = $(pager).find(':input[name=selectionMode]').val();
|
||||
updateCounter(table, pager);
|
||||
}
|
||||
|
||||
function updateCounter(table, pager)
|
||||
{
|
||||
var ex = $(':input[name^=storedSelection]', pager).length;
|
||||
@@ -205,6 +211,25 @@ function sprintf(format, etc) {
|
||||
}
|
||||
|
||||
fixPosition(table,tableBody);
|
||||
applySelection(table);
|
||||
|
||||
$(table).trigger("applyWidgets");
|
||||
|
||||
if( c.page >= c.totalPages ) {
|
||||
moveToLastPage(table);
|
||||
}
|
||||
|
||||
updatePageDisplay(c);
|
||||
updateCounter(table, table.config.container);
|
||||
renderPager(table, table.config.container);
|
||||
$(table).tableHover();
|
||||
$('#loading', table.config.container).empty();
|
||||
});
|
||||
}
|
||||
|
||||
function applySelection(table)
|
||||
{
|
||||
var c = table.config;
|
||||
if (c.selectionMode == 'negative')
|
||||
{
|
||||
$(table).find(':checkbox[name^=selectObj]').attr('checked', true);
|
||||
@@ -228,7 +253,7 @@ function sprintf(format, etc) {
|
||||
});
|
||||
|
||||
$(table).find(':checkbox[name^=selectObj]').change(function() {
|
||||
updateSelection(table, table.config.container, this.value, this.checked);
|
||||
storeSelection(table, table.config.container, this.value, this.checked);
|
||||
});
|
||||
}
|
||||
else if (table.config.select_mode == 'single')
|
||||
@@ -249,22 +274,9 @@ function sprintf(format, etc) {
|
||||
});
|
||||
|
||||
$(table).find('input[name^=selectObject]:radio').change(function() {
|
||||
updateSelection(table, table.config.container, this.value, this.checked);
|
||||
storeSelection(table, table.config.container, this.value, this.checked);
|
||||
});
|
||||
}
|
||||
|
||||
$(table).trigger("applyWidgets");
|
||||
|
||||
if( c.page >= c.totalPages ) {
|
||||
moveToLastPage(table);
|
||||
}
|
||||
|
||||
updatePageDisplay(c);
|
||||
updateCounter(table, table.config.container);
|
||||
renderPager(table, table.config.container);
|
||||
$(table).tableHover();
|
||||
$('#loading', table.config.container).empty();
|
||||
});
|
||||
}
|
||||
|
||||
function renderPager(table, pager)
|
||||
@@ -400,9 +412,13 @@ function sprintf(format, etc) {
|
||||
$(table).find(':checkbox.checkAll').removeAttr('onclick').click(function() {
|
||||
return checkAll(table, pager, this.checked);
|
||||
});
|
||||
|
||||
$(table).bind('load_selection', function() {
|
||||
loadSelection(table, pager);
|
||||
applySelection(table);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
});
|
||||
// extend plugin scope
|
||||
|
||||
Reference in New Issue
Block a user