PM-1711 "Al ir a la siguiente pagina en los listados..." SOLVED
Issue:
Al ir a la siguiente pagina en los listados, se cambia el orden a ascendente
Cause:
Al hacer click en el paginador el atributo "currentOrder" no se actualiza para
el objeto instanciado de la clase "G_PagedTable"
Solution:
Se actualiza el atributo "currentOrder" del objeto, esto cuando se hace click
en el paginador
This commit is contained in:
@@ -338,18 +338,18 @@ class propelTable
|
|||||||
if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail )))) {
|
if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail )))) {
|
||||||
//if (($this->style[$r]['showInTable'] != '0' ))
|
//if (($this->style[$r]['showInTable'] != '0' ))
|
||||||
$this->tpl->newBlock( "headers" );
|
$this->tpl->newBlock( "headers" );
|
||||||
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? 'DESC' : 'ASC');
|
|
||||||
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '' : $sortOrder);
|
$sortDir = "ASC";
|
||||||
|
|
||||||
|
if (isset($this->aOrder[$this->fields[$r]["Name"]])) {
|
||||||
|
$sortDir = ($this->aOrder[$this->fields[$r]["Name"]] == "ASC")? "DESC" : "ASC";
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->style[$r]['titleVisibility'] != '0') {
|
if ($this->style[$r]['titleVisibility'] != '0') {
|
||||||
$this->style[$r]['href'] = $this->ownerPage . '?order=' . ($sortOrder !== '' ? (G::createUID( '', $this->fields[$r]['Name'] ) . '=' . $sortOrder) : '') . '&page=' . $this->currentPage;
|
$this->style[$r]["href"] = "javascript:;";
|
||||||
if ($this->sortable == '0') {
|
$this->style[$r]["onsort"] = $this->id . ".doSort(\"" . G::createUID("", $this->fields[$r]["Name"]) . "\", \"" . (($this->sortable == "0")? "" : $sortDir) . "\"); return false;";
|
||||||
$this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID( '', $this->fields[$r]['Name'] ) . '" , ""); return false;';;
|
|
||||||
} else {
|
|
||||||
$this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID( '', $this->fields[$r]['Name'] ) . '" , "' . $sortOrder . '"); return false;';
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$this->style[$r]['href'] = '#';
|
$this->style[$r]["href"] = "javascript:;";
|
||||||
$this->style[$r]['onsort'] = 'return false;';
|
$this->style[$r]['onsort'] = 'return false;';
|
||||||
}
|
}
|
||||||
if (isset( $this->style[$r]['href'] )) {
|
if (isset( $this->style[$r]['href'] )) {
|
||||||
@@ -378,10 +378,14 @@ class propelTable
|
|||||||
$this->tpl->assign( "align", 'text-align:' . $this->style[$r]['titleAlign'] . ';' );
|
$this->tpl->assign( "align", 'text-align:' . $this->style[$r]['titleAlign'] . ';' );
|
||||||
}
|
}
|
||||||
if ($this->style[$r]['titleVisibility'] != '0') {
|
if ($this->style[$r]['titleVisibility'] != '0') {
|
||||||
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? '<img src="/images/arrow-up.gif">' : '');
|
$sortDirImg = "";
|
||||||
$sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '<img src="/images/arrow-down.gif">' : $sortOrder);
|
|
||||||
$this->tpl->assign( "header", $this->fields[$r]['Label'] . $sortOrder );
|
if (isset($this->aOrder[$this->fields[$r]["Name"]])) {
|
||||||
$this->tpl->assign( 'displaySeparator', (($this->colCount == 0) || (! isset( $this->fields[$r]['Label'] )) || ($this->fields[$r]['Label'] === '')) ? 'display:none;' : '' );
|
$sortDirImg = ($this->aOrder[$this->fields[$r]["Name"]] == "ASC")? "<img src=\"/images/arrow-up.gif\" />" : "<img src=\"/images/arrow-down.gif\" />";
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tpl->assign("header", $this->fields[$r]["Label"] . $sortDirImg);
|
||||||
|
$this->tpl->assign("displaySeparator", ($this->colCount == 0 || !isset($this->fields[$r]["Label"]) || $this->fields[$r]["Label"] == "")? "display: none;" : "");
|
||||||
} else {
|
} else {
|
||||||
$this->tpl->assign( 'displaySeparator', 'display:none;' );
|
$this->tpl->assign( 'displaySeparator', 'display:none;' );
|
||||||
}
|
}
|
||||||
@@ -753,29 +757,30 @@ class propelTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$strjsCurrentOrder = $this->id . ".currentOrder = '" . addslashes($this->orderBy) . "';";
|
||||||
|
|
||||||
$this->tpl->assign( '_ROOT.gridRows', '=' . $gridRows ); //number of rows in the current page
|
$this->tpl->assign( '_ROOT.gridRows', '=' . $gridRows ); //number of rows in the current page
|
||||||
$this->tpl->newBlock( 'rowTag' );
|
$this->tpl->newBlock( 'rowTag' );
|
||||||
$this->tpl->assign( 'rowId', 'insertAtLast' );
|
$this->tpl->assign( 'rowId', 'insertAtLast' );
|
||||||
if ($this->currentPage > 1) {
|
if ($this->currentPage > 1) {
|
||||||
$firstUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=1';
|
|
||||||
$firstAjax = $this->id . ".doGoToPage(1);return false;";
|
|
||||||
$prevpage = $this->currentPage - 1;
|
$prevpage = $this->currentPage - 1;
|
||||||
$prevUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $prevpage;
|
|
||||||
$prevAjax = $this->id . ".doGoToPage(" . $prevpage . ");return false;";
|
$firstAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(1); return false;";
|
||||||
$first = "<a href=\"" . htmlentities( $firstUrl, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $firstAjax . "\" class='firstPage'> </a>";
|
$prevAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $prevpage . "); return false;";
|
||||||
$prev = "<a href=\"" . htmlentities( $prevUrl, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $prevAjax . "\" class='previousPage'> </a>";
|
$first = "<a href=\"javascript:;\" onclick=\"" . $firstAjax . "\" class=\"firstPage\"> </a>";
|
||||||
|
$prev = "<a href=\"javascript:;\" onclick=\"" . $prevAjax . "\" class=\"previousPage\"> </a>";
|
||||||
} else {
|
} else {
|
||||||
$first = "<a class='noFirstPage'> </a>";
|
$first = "<a class='noFirstPage'> </a>";
|
||||||
$prev = "<a class='noPreviousPage'> </a>";
|
$prev = "<a class='noPreviousPage'> </a>";
|
||||||
}
|
}
|
||||||
if ($this->currentPage < $this->totPages) {
|
if ($this->currentPage < $this->totPages) {
|
||||||
$lastUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $this->totPages;
|
|
||||||
$lastAjax = $this->id . ".doGoToPage(" . $this->totPages . ");return false;";
|
|
||||||
$nextpage = $this->currentPage + 1;
|
$nextpage = $this->currentPage + 1;
|
||||||
$nextUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $nextpage;
|
|
||||||
$nextAjax = $this->id . ".doGoToPage(" . $nextpage . ");return false;";
|
$nextAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $nextpage . "); return false;";
|
||||||
$next = "<a href=\"" . htmlentities( $nextUrl, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $nextAjax . "\" class='nextPage'> </a>";
|
$lastAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $this->totPages . "); return false;";
|
||||||
$last = "<a href=\"" . htmlentities( $lastUrl, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $lastAjax . "\" class='lastPage'> </a>";
|
$next = "<a href=\"javascript:;\" onclick=\"" . $nextAjax . "\" class=\"nextPage\"> </a>";
|
||||||
|
$last = "<a href=\"javascript:;\" onclick=\"" . $lastAjax . "\" class=\"lastPage\"> </a>";
|
||||||
} else {
|
} else {
|
||||||
$next = "<a class='noNextPage'> </a>";
|
$next = "<a class='noNextPage'> </a>";
|
||||||
$last = "<a class='noLastPage'> </a>";
|
$last = "<a class='noLastPage'> </a>";
|
||||||
@@ -783,9 +788,10 @@ class propelTable
|
|||||||
$pagesEnum = '';
|
$pagesEnum = '';
|
||||||
for ($r = 1; $r <= $this->totPages; $r ++) {
|
for ($r = 1; $r <= $this->totPages; $r ++) {
|
||||||
if (($r >= ($this->currentPage - 5)) && ($r <= ($this->currentPage + 5))) {
|
if (($r >= ($this->currentPage - 5)) && ($r <= ($this->currentPage + 5))) {
|
||||||
$pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;";
|
$pageAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $r . "); return false;";
|
||||||
|
|
||||||
if ($r != $this->currentPage) {
|
if ($r != $this->currentPage) {
|
||||||
$pagesEnum .= " <a href=\"" . htmlentities( $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $pageAjax . "\">" . $r . "</a>";
|
$pagesEnum .= " <a href=\"javascript:;\" onclick=\"" . $pageAjax . "\">" . $r . "</a>";
|
||||||
} else {
|
} else {
|
||||||
$pagesEnum .= " <a>" . $r . "</a>";
|
$pagesEnum .= " <a>" . $r . "</a>";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user