Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

GridFieldDeleteAction not delete in DB


Go to End


3 Posts   2247 Views

Avatar
Craftnet

Community Member, 58 Posts

15 July 2012 at 7:34pm

Hi,
I have problem.

I have DataObject Aktualnosc

class Aktualnosc extends DataObject {
 
	static $db = array(
		'Date' => 'Date',
      	'Tresc' => 'Text',
   	);
   
   static $belongs_many_many = array(
      'HomePage' => 'HomePage'
   );
   
   public static $has_one = array(
   		'Photo' => 'Image'
	);
	
	public static $summary_fields = array(
		'Tresc' => 'Treść',
		'Date' => 'Date',
	);
 
   
   function getCMSFields() {
      $fields = new FieldSet();
	  $fields->push( $dateField = new DateField('Date', 'Data aktualności'), 'Content' );
	  $fields->push( new TextField('Tresc', 'Krótka treść' ));
	  $fields->push( new UploadField( 'Photo', 'Zdjęcie' ) );
	  $dateField->setConfig('showcalendar', true);
      $dateField->setConfig('dateformat', 'dd-MM-YYYY');
      return $fields;
   }
 
}

and HomePage.php


class HomePage extends Page {
...

static $many_many = array(
      'Aktualnosci' => 'Aktualnosc',      
   );

 public function getCMSFields() {
    	$fields = parent::getCMSFields();
		
		$gridFieldConfigNews = GridFieldConfig::create()->addComponents(
			new GridFieldToolbarHeader(''),
            new GridFieldAddNewButton('toolbar-header-right'),
			new GridFieldSortableHeader(''),
			new GridFieldDataColumns(),
			new GridFieldPaginator(50),
			new GridFieldEditButton(),
			new GridFieldDeleteAction(),
			new GridFieldFilterHeader(''),
			new GridFieldDetailForm()
		);
		$gridfieldNews = new GridField('Aktualnosci', 'Aktualności', $this->Aktualnosci(), $gridFieldConfigNews);
		$fields->addFieldToTab('Root.Aktualnosci', $gridfieldNews);
		

		
        return $fields;
		
    }

class HomePage_Controller extends Page_Controller {

....
	 
}

When I delete post with GridFieldDeleteAction entry in the list delete but in DB is still.

Otherwise in writing.
When I try to delete an entry by clicking on the delete in the list he delete, but in the database is still

Can anyone help

Sorry for my bad English

Attached Files
Avatar
purplespider

Community Member, 89 Posts

22 August 2012 at 9:12am

Is someone able to help with the solution to this?

I presume it is to do with GridFieldDeleteAction(true) but that just adds in an extra unlink icon, when I just want the delete icon to actually delete the record.

Thanks

Avatar
Craftnet

Community Member, 58 Posts

6 September 2012 at 2:25am

In new SS 3.0.2 RC1 fix it
Change GridFieldDeleteAction in framework/fields/gridfield

code from here:
https://github.com/silverstripe/sapphire/commit/9a8313d