Author: lombardot
Date: 2010-05-25 14:58:06 +0200 (Tue, 25 May 2010)
New Revision: 29617
Modified:
plugins/sfDatagridPlugin/lib/sfDatagrid.class.php
plugins/sfDatagridPlugin/lib/sfDatagridFormatter.class.php
Log:
sfDatagridPlugin Add onclick formatter
Modified: plugins/sfDatagridPlugin/lib/sfDatagrid.class.php
===================================================================
--- plugins/sfDatagridPlugin/lib/sfDatagrid.class.php 2010-05-25 11:01:27 UTC
(rev 29616)
+++ plugins/sfDatagridPlugin/lib/sfDatagrid.class.php 2010-05-25 12:58:06 UTC
(rev 29617)
@@ -36,7 +36,7 @@
$columnsOptions = array(), // The columns
attributes (style, width, etc.)
$defaultSort = array(), // The default sorting
options
$request = null, // The request
(autoset)
- $datagridActions = array(), // The datagrid actions
(select box on the top)
+ $datagridActions = array(), // The datagrid actions
(select box on the top)
$moduleAction = null, // The module name and
the action name (autoset)
$rowAction = null, // The link for
the row (e.g. to edit)
$columnsSort = array(), // The columns custom
sorting options
@@ -462,8 +462,10 @@
}
return new $class($this);
- }
+ }
+
+
/**
* Get the html output for the datagrid
*
Modified: plugins/sfDatagridPlugin/lib/sfDatagridFormatter.class.php
===================================================================
--- plugins/sfDatagridPlugin/lib/sfDatagridFormatter.class.php 2010-05-25
11:01:27 UTC (rev 29616)
+++ plugins/sfDatagridPlugin/lib/sfDatagridFormatter.class.php 2010-05-25
12:58:06 UTC (rev 29617)
@@ -34,7 +34,9 @@
// The datagrid action bar
$datagridActions = '<table cellspacing="0" cellpadding="0"
class="grid-actions"><tr><td valign="middle" class="left-actions"><span
class="pager">%links%</span></td><td align="right" valign="middle"
class="right-actions">%actions%</td></table>',
// To check all for batch_actions
- $datagridCheckAll= '<input type="checkbox" name="check_all"
onchange="dg_check_all(this)" />';
+ $datagridCheckAll= '<input type="checkbox" name="check_all"
onchange="dg_check_all(this)" />',
+ //The formater for onclick
+ $onClick="document.location.href='%url%'";
protected
$P_ORDER = 'dg_order',
$P_SORT = 'dg_sort',
@@ -467,14 +469,14 @@
if($rowIndex === false){
if(!is_null($rowIndexDefaultValue)){
-
$this->addOption('onclick', $rowOptions[$columnName],
"document.location.href='" . url_for(strtr($rowAction, array('%' .
$matches['param'] . '%' => $rowIndexDefaultValue))) . "'");
+
$this->addOption('onclick', $rowOptions[$columnName],
strtr($this->onClick,array('url'=>url_for(strtr($rowAction, array('%' .
$matches['param'] . '%' => $rowIndexDefaultValue))))));
$this->addOption('style', $rowOptions[$columnName], 'cursor:pointer;');
}else{
throw new
Exception("Impossible to find column ".$matches['param']);
}
}else{
- $this->addOption('onclick',
$rowOptions[$columnName], "document.location.href='" .
url_for(strtr($rowAction, array('%' . $matches['param'] . '%' =>
$rowValues[$rowIndex]))) . "'");
+ $this->addOption('onclick',
$rowOptions[$columnName],
strtr($this->onClick,array('url'=>url_for(strtr($rowAction, array('%' .
$matches['param'] . '%' => $rowIndexDefaultValue))))));
$this->addOption('style',
$rowOptions[$columnName], 'cursor:pointer;');
}
}
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.