mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-05 09:04:19 +01:00
New implementation for displaying long lists: pagination
SVN:trunk[1309]
This commit is contained in:
@@ -38,7 +38,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
|
||||
{
|
||||
if (me.ajax_request)
|
||||
{
|
||||
me.ajax_request.Abort();
|
||||
me.ajax_request.abort();
|
||||
me.ajax_request = null;
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,16 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
|
||||
|
||||
this.DoOk = function()
|
||||
{
|
||||
var iObjectId = $('#fr_'+me.id+' input[name=selectObject]:checked').val();
|
||||
var s = $('#'+me.id+'_results').find(':input[name^=storedSelection]');
|
||||
var iObjectId = 0;
|
||||
if (s.length > 0)
|
||||
{
|
||||
iObjectId = s.val();
|
||||
}
|
||||
else
|
||||
{
|
||||
iObjectId = $('#fr_'+me.id+' input[name=selectObject]:checked').val();
|
||||
}
|
||||
$('#ac_dlg_'+this.id).dialog('close');
|
||||
$('#label_'+this.id).addClass('ac_dlg_loading');
|
||||
|
||||
|
||||
@@ -147,6 +147,12 @@ function sprintf(format, etc) {
|
||||
|
||||
function getData(table, start, end)
|
||||
{
|
||||
if (table.ajax_request)
|
||||
{
|
||||
table.ajax_request.abort();
|
||||
table.ajax_request = null;
|
||||
}
|
||||
|
||||
var c = table.config;
|
||||
var s = c.sortList[0];
|
||||
var s_col = null;
|
||||
@@ -157,7 +163,7 @@ function sprintf(format, etc) {
|
||||
s_order = (s[1] == 0) ? 'asc' : 'desc';
|
||||
}
|
||||
$('#loading', table.config.container).html('<img src="../images/indicator.gif" />');
|
||||
$.post("../pages/ajax.render.php",
|
||||
table.ajax_request = $.post("../pages/ajax.render.php",
|
||||
{ operation: 'pagination',
|
||||
filter: c.filter,
|
||||
extra_param: c.extra_params,
|
||||
@@ -171,6 +177,7 @@ function sprintf(format, etc) {
|
||||
},
|
||||
function(data)
|
||||
{
|
||||
table.ajax_request = null; // Ajax request completed
|
||||
oData = $(data);
|
||||
var tableBody = $(table.tBodies[0]);
|
||||
|
||||
@@ -251,6 +258,7 @@ function sprintf(format, etc) {
|
||||
updatePageDisplay(c);
|
||||
updateCounter(table, table.config.container);
|
||||
renderPager(table, table.config.container);
|
||||
$(table).tableHover();
|
||||
$('#loading', table.config.container).empty();
|
||||
});
|
||||
}
|
||||
@@ -353,6 +361,8 @@ function sprintf(format, etc) {
|
||||
|
||||
var table = this, pager = config.container;
|
||||
|
||||
this.ajax_request = null;
|
||||
|
||||
$(this).trigger("appendCache");
|
||||
|
||||
config.size = parseInt($(".pagesize",pager).val());
|
||||
|
||||
@@ -70,6 +70,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates)
|
||||
bDuplicates: me.bDuplicates
|
||||
}
|
||||
|
||||
me.UpdateButtons(0);
|
||||
// Gather the parameters from the search form
|
||||
$('#SearchFormToAdd_'+me.id+' :input').each(
|
||||
function(i)
|
||||
|
||||
18
js/utils.js
18
js/utils.js
@@ -82,24 +82,6 @@ function ReloadBlock(divId, sStyle, sSerializedFilter, sExtraParams)
|
||||
$('#'+divId).empty();
|
||||
$('#'+divId).append(data);
|
||||
$('#'+divId).removeClass('loading');
|
||||
$('#'+divId+' .listResults').tableHover(); // hover tables
|
||||
$('#'+divId+' .listResults').each( function()
|
||||
{
|
||||
var table = $(this);
|
||||
var id = $(this).parent();
|
||||
var checkbox = (table.find('th:first :checkbox').length > 0);
|
||||
if (checkbox)
|
||||
{
|
||||
// There is a checkbox in the first column, don't make it sortable
|
||||
table.tablesorter( { headers: { 0: {sorter: false}}, widgets: ['myZebra', 'truncatedList']} ); // sortable and zebra tables
|
||||
}
|
||||
else
|
||||
{
|
||||
// There is NO checkbox in the first column, all columns are considered sortable
|
||||
table.tablesorter( { widgets: ['myZebra', 'truncatedList']} ); // sortable and zebra tables
|
||||
}
|
||||
});
|
||||
//$('#'+divId).unblockUI();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user