Structures_DataGrid::setUrlFormat
Synopsis
void
Structures_DataGrid::setUrlFormat
(
mixed
$format
,
string
$prefix
= null
,
string
$scriptname
= null
)
Description
If this is set, it will be parsed instead of GET/POST. This is only supported on PHP5, as it depends on Net_URL_Mapper.
There are three possible placeholders, :pager, :orderBy and :direction. :page or (:orderBy and :direction) can be used alone.
It is possible to use multipe DataGrid instances on one page with different prefixes.
Instead of a format string you might also pass a Net_URL_Mapper instance to this method, in which case $prefix and $scriptname will be ignored. This instance must be properly set up, connected to url patterns, etc... This is especially useful when you've already configured URL mapping globally for your application and want Structures_DataGrid to integrate.
Parameter
-
mixed
$format
-
The URL format string or a Net_URL_Mapper instance
-
string
$prefix
-
Sets the url prefix
-
string
$scriptname
-
Set the scriptname if mod_rewrite not available
Throws
throws Net_URL_Mapper_InvalidException
Examples
configure a url format
<?php
// identical, for example /page/5/foo/ASC
$datagrid->setUrlFormat('/page/:page/:orderBy/:direction');
$datagrid->setUrlFormat('/:page/:orderBy/:direction', 'page');
// without /page, for example /5/foo/ASC
$datagrid->setUrlFormat('/:page/:orderBy/:direction');
// without paging, for example /sort/foo/ASC
$datagrid->setUrlFormat('/:orderBy/:direction', 'sort');
// with scriptname, for example /index.php/5/foo/ASC
$datagrid->setUrlFormat('/:page/:orderBy/:direction', 'page', 'index.php');
?>
Note
This function can not be called statically.