vatsalpande  
          
              
                February 17, 2011, 12:14pm
               
              1 
           
         
        
          Hi All,
I am working on CgridView. I want to display a message whenever an entry is deleted from the Grid.
Right now it is deleting the entry but not showing any confirmation message that the message is deleted. Yes, it asks before deleting but I want to confirm it by showing the display message that the message is deleted.
The code that I am using is:
<?php
$this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'faq-grid',
'dataProvider'=>$model->search(),
'columns'=>array(
array(
     'name'=>'Question',
     'type'=>'raw',
      'value'=>'$data->FaqQuestion'
 ),
 array(
    'name'=>'Answer',
    'type'=>'raw',
     'value'=>'$data->FaqAnswer'
  ),
  array( 
       'class'=>'CButtonColumn',
   ),
),
));
?>
Any help will be appreciated
Regards
         
        
           
         
            
       
      
        
          
          
            APXu_KPblc  
          
              
                February 17, 2011, 12:27pm
               
              2 
           
         
        
          If i’m not mistaken, flash messages would be your sollution, try setFlash() method
         
        
           
         
            
       
      
        
          
          
            mdomba  
          
              
                February 17, 2011, 12:36pm
               
              3 
           
         
        
          Just recently CButtonColumn::afterDelete was added for this purpose - http://code.google.c …e/detail?r=2965
To get this you need to get the SVN version or wait for version 1.1.7
But note that even if you get a successful ajax call it does not mean that the delete was successful.
         
        
           
         
            
       
      
        
          
          
            vatsalpande  
          
              
                February 17, 2011, 12:57pm
               
              4 
           
         
        
          Thanks a lot…
So is it any way to do that till 1.17 is released???
And can u give me an example how to use this property
         
        
           
         
            
       
      
        
          
          
            mdomba  
          
              
                February 17, 2011,  1:54pm
               
              5 
           
         
        
          You can download the "Nightly Snapshot" on the Yii download page
Example:
...
array(
   class'=>'CButtonColumn',
   'afterDelete'=>'function(link,success){ if(success) alert("Delete completed successfuly"); }',
),
...
 
        
           
         
            
       
      
        
        
          Thanks for the reply
But the nightly snapshot is not yet stable
Can i still use it??
and sorry to sound stupid but how to upgrade my already existing code to this release…
Can it break my functionality by any means??
Regards
         
        
           
         
            
       
      
        
          
          
            tri  
          
              
                February 18, 2011,  8:00am
               
              7 
           
         
        
          
 vatsalpande:
 
Thanks for the reply
But the nightly snapshot is not yet stable
Can i still use it??
and sorry to sound stupid but how to upgrade my already existing code to this release…
Can it break my functionality by any means??
Regards
 
 
Of course it might  break functionality if you are unlucky. Examine the change log for changes that may constitute a risk.
/Tommy
         
        
           
         
            
       
      
        
          
          
            mdomba  
          
              
                February 18, 2011,  8:24am
               
              8 
           
         
        
          You have not specified what version you are using currently… if you are using Yii 1.1.6 than most probably you will not have any problem…
But …
the nightly snapshot is made every night… so if you decide to use it… you need to track the changes made that day as almost every day there is a new commit…
you can see the changes here - http://code.google.com/p/yii/source/list 
In any case first thing to do is a backup of your complete project with the current Yii version…
On the other side… for this case… if you need just the afterDelete option you can download only the CButtonColumn.php file on link I wrote you in comment #3 
         
        
           
         
            
       
      
        
        
          Thanks a lot.
I have upgraded to the nighty sample and till now everything is working fine.
I hope to same to remain
Regards
         
        
           
         
            
       
      
        
          
          
            vatsalpande  
          
              
                February 18, 2011,  9:05am
               
              10 
           
         
        
          I am using Yii Versionn 1.1.4
         
        
           
         
            
       
      
        
          
          
            vatsalpande  
          
              
                February 18, 2011,  9:08am
               
              11 
           
         
        
          Downloading only CbuttonColumn didn’t help
I am getting an error
Property CButtonColumn.afterDelete is not defined
         
        
           
         
            
       
      
        
          
          
            mdomba  
          
              
                February 18, 2011, 10:00am
               
              12 
           
         
        
          
Strange because the afterDelete is declared there… if you want to use only the new CButtonColumn, then you need to put it in the framework folder (replace the old one)… and it should work…
         
        
           
         
            
       
      
        
          
          
            vatsalpande  
          
              
                February 22, 2011,  2:32pm
               
              13 
           
         
        
          Hey…
It worked…
I might have done something wrong earlier…
I have tried that again and replacing only CButtonColumn had solved the problem…
Thnx for helping me out
Regards
         
        
           
         
            
       
      
        
          
          
            mdomba  
          
              
                February 22, 2011,  2:40pm
               
              14 
           
         
        
          Just today I changed a bit the afterDelete… added 3rd parameter (data) so that you can get the result of the server call in afterDelete…
         
        
           
         
            
       
      
        
          
          
            vatsalpande  
          
              
                February 26, 2011,  6:48pm
               
              15 
           
         
        
          
Hiii
Thnx for the info…
so should I get the latest nightly build for this file???
Regards
         
        
           
         
            
       
      
        
          
          
            gusnips  
          
              
                February 26, 2011,  7:08pm
               
              16 
           
         
        
          Is either that or customize your CButtonColumn