Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » GridFieldDeleteAction not delete in DB

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

Page: 1
Go to End
Author Topic: 626 Views
  • Craftnet
    Avatar
    Community Member
    58 Posts

    GridFieldDeleteAction not delete in DB Link to this post

    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
  • purplespider
    Avatar
    Community Member
    81 Posts

    Re: GridFieldDeleteAction not delete in DB Link to this post

    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

  • Craftnet
    Avatar
    Community Member
    58 Posts

    Re: GridFieldDeleteAction not delete in DB Link to this post

    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

    626 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.