From ca595b1003ce1f6269dd8843d91148d7de09ec6a Mon Sep 17 00:00:00 2001 From: Omer Yariv Date: Thu, 12 Jul 2012 13:37:40 -0400 Subject: [PATCH] allow custom key option for sction allow user to supply a different key than 'id' for actions on the grid. 'id' still remains the default choice --- extensions/helper/Grid.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/helper/Grid.php b/extensions/helper/Grid.php index 6ffb556..5f261c3 100644 --- a/extensions/helper/Grid.php +++ b/extensions/helper/Grid.php @@ -145,7 +145,7 @@ public function render($grid, $options = array()) { $options['onclick'] = "return confirm('$confirm');"; unset($options['confirm']); } - $options += array('class' => $action); + $options += array('class' => $action, 'key' => 'id'); if (isset($options['url'])) { $url = $options['url']($row); if (!$url) { @@ -158,7 +158,7 @@ public function render($grid, $options = array()) { if ($url === true) { $url = array( 'action' => $action, - 'args' => array($row['id']) + 'args' => array($row[$options['key']]) ); } if (isset($titles[$action])) {