mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Added TableListField->paginationBaseLink
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@86338 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e7add7a943
commit
f86bc6f715
@ -181,6 +181,13 @@ class TableListField extends FormField {
|
|||||||
*/
|
*/
|
||||||
protected $showPagination = false;
|
protected $showPagination = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Override the {@link Link()} method
|
||||||
|
* for all pagination. Useful to force rendering of the field
|
||||||
|
* in a different context.
|
||||||
|
*/
|
||||||
|
public $paginationBaseLink = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Number of items to show on a single page (needed for pagination)
|
* @var int Number of items to show on a single page (needed for pagination)
|
||||||
*/
|
*/
|
||||||
@ -757,7 +764,8 @@ JS
|
|||||||
if(!isset($_REQUEST['ctf'][$this->Name()]['start']) || !is_numeric($_REQUEST['ctf'][$this->Name()]['start']) || $_REQUEST['ctf'][$this->Name()]['start'] == 0) {
|
if(!isset($_REQUEST['ctf'][$this->Name()]['start']) || !is_numeric($_REQUEST['ctf'][$this->Name()]['start']) || $_REQUEST['ctf'][$this->Name()]['start'] == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$link = Controller::join_links($this->Link(), "?ctf[{$this->Name()}][start]={$start}");
|
$baseLink = ($this->paginationBaseLink) ? $this->paginationBaseLink : $this->Link();
|
||||||
|
$link = Controller::join_links($baseLink, "?ctf[{$this->Name()}][start]={$start}");
|
||||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
@ -771,7 +779,8 @@ JS
|
|||||||
|
|
||||||
$start = ($_REQUEST['ctf'][$this->Name()]['start'] - $this->pageSize < 0) ? 0 : $_REQUEST['ctf'][$this->Name()]['start'] - $this->pageSize;
|
$start = ($_REQUEST['ctf'][$this->Name()]['start'] - $this->pageSize < 0) ? 0 : $_REQUEST['ctf'][$this->Name()]['start'] - $this->pageSize;
|
||||||
|
|
||||||
$link = Controller::join_links($this->Link(), "?ctf[{$this->Name()}][start]={$start}");
|
$baseLink = ($this->paginationBaseLink) ? $this->paginationBaseLink : $this->Link();
|
||||||
|
$link = Controller::join_links($baseLink, "?ctf[{$this->Name()}][start]={$start}");
|
||||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
@ -783,7 +792,8 @@ JS
|
|||||||
if($currentStart >= $start-1) {
|
if($currentStart >= $start-1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$link = Controller::join_links($this->Link(), "?ctf[{$this->Name()}][start]={$start}");
|
$baseLink = ($this->paginationBaseLink) ? $this->paginationBaseLink : $this->Link();
|
||||||
|
$link = Controller::join_links($baseLink, "?ctf[{$this->Name()}][start]={$start}");
|
||||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
@ -796,7 +806,8 @@ JS
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = Controller::join_links($this->Link(), "?ctf[{$this->Name()}][start]={$start}");
|
$baseLink = ($this->paginationBaseLink) ? $this->paginationBaseLink : $this->Link();
|
||||||
|
$link = Controller::join_links($baseLink, "?ctf[{$this->Name()}][start]={$start}");
|
||||||
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
if($this->extraLinkParams) $link .= "&" . http_build_query($this->extraLinkParams);
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user