Permalink
Browse files

BUGFIX Fix edit and delete actions on gridfield

  • Loading branch information...
1 parent 2670501 commit 23af60633c13fc53744b5e71e6a34c9d0f93ccbd @andrewandante andrewandante committed Feb 9, 2012
Showing with 6 additions and 7 deletions.
  1. +6 −7 forms/gridfield/GridFieldAction.php
@@ -58,7 +58,7 @@ public function getColumnsHandled($gridField) {
* @return array
*/
public function getActions($gridField) {
- return array('deleterecord');
+ return array();
}
/**
@@ -69,7 +69,7 @@ public function getActions($gridField) {
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName) {
- return sprintf('<a class="action-edit" href="%s">%s</a>', Controller::join_links($gridField->Link('item'), $record->ID, 'edit'), _t('GridAction.Edit', 'edit'));
+ return sprintf('<a class="action-edit" href="%s">%s</a> ', Controller::join_links($gridField->Link('item'), $record->ID, 'edit'), _t('GridAction.Edit', 'edit'));
}
/**
@@ -177,12 +177,11 @@ public function getColumnContent($gridField, $record, $columnName) {
* @return void
*/
public function handleAction(GridField $gridField, $actionName, $arguments, $data) {
- $id = $arguments['RecordID'];
- $item = $gridField->getList()->byID($id);
- if(!$item) return;
-
if($actionName == 'deleterecord') {
- $item->delete();
+ $id = $arguments['RecordID'];
+ $item = $gridField->getList()->byID($id);
+ if(!$item) return;
+ $item->delete();
}
}
}

0 comments on commit 23af606

Please sign in to comment.