Modify Delete command in manage section

Hi all,

I am a newbie to Yii framework and currently developing the admin section of a website. I have option to delete the main menu in the manage(admin.php) section.When i press the delete (X) button,i want to delete all the pages that come under the main menu and also display the warning. The current confirm message is "Are you sure you want to delete this item". But i want to change it to "Are you sure you want to delete this menu and all assosiated pages?". And then perform delete action. How can i modify the confirm message.I know how to modify the message shown in side menu in view page. Also in which page does the delete action takes place.So that i can run a sql command to delete all pages assosiated with the menu in another table. Thanx in advance…

First of all, let me be the first member who welcomes you to this forum! :)

If I understand you correctly, this delete button is on CGridView, isn’t it? You can do this:




$this->widget('zii.widgets.grid.CGridView', array(

  ....

  'columns'=>array(

     .... (your other columns)

     array(

	'class'=>'CButtonColumn',

	'deleteConfirmation'=>'Are you sure you want to delete this menu and all assosiated pages?'

     ),

  ),

)); ?>



In controller that related to your page (‘protected/controllers/…Controller.php’) . You can check actionDelete() method.




$this->widget('zii.widgets.grid.CGridView', array( 

  // ...

  array(

    'class'=>'CButtonColumn',

    'deleteConfirmation'=>'Are you sure you want to delete this menu and all assosiated pages?',

  )

  // ...

));



[edit]rei beat me to it … :)[/edit]

Thanks for your response,that solved part of my problem. But regarding the delete conformation i get an error like:

Manage Main Menu

You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.

Advanced Search

Fatal error: Using $this when not in object context in C:\xampp\htdocs\harrislaw2\yii\framework\zii\widgets\grid\CGridView.php on line 52

I uncommented the section you specified and it now look like this:

  • objects using the dot-syntax as shown below:

*/

$this->widget(‘zii.widgets.grid.CGridView’, array(

  'dataProvider'=&gt;&#036;dataProvider,


  'columns'=&gt;array(


      'title',          // display the 'title' attribute


      'category.name',  // display the 'name' attribute of the 'category' relation


      'content:html',   // display the 'content' attribute as purified HTML


      


      


      array(            // display a column with &quot;view&quot;, &quot;update&quot; and &quot;delete&quot; buttons


          'class'=&gt;'CButtonColumn',


          'deleteConfirmation'=&gt;'Are you sure you want to delete this menu and all assosiated pages?'





      ),


  ),

));

/* Please refer to {@link columns} for more details about how to configure this property.