php - Delete operation in CGridView in yii. -
I am using CGRidVeiw to create a list of my records from the database, one edit and delete one in each record The button has. Ethernet is working except for the fn9 removal operation, in fact it is seeing error after clicking on the deleted icon, but its still working. It's a snap below how it actually looks,
< / P>
After refreshing the record is not being shown to me as my idea and contoller is below.
// contoller
Public function ActionDialtemier () {$ Models = New AdminDeleteEmployer (); If (isset ($ _GET ['id'])) {$ id = $ _GET ['id']; } $ Query = "Delete from user, jobs using jobs, jobs on job, user.id = user.id WHERE user.id = $ id"; Yii :: app () - & gt; Db- & gt; CreateCommand ($ query) - & gt; QueryAll (); $ This- & gt; Redirect ('admin / site / manageEmployers'); }
View ///
Manage Employers
& lt; Div class = "form" & gt; & Lt ;? Php $ this- & gt; Widgets ('zii.widgets.grid.CgrridView', array ('data provider' => = model- & gt; search), 'ajaxUpdate' = & gt; wrong, // 'filter' = & gt; $ models , 'Column' = & gt; array (array ('name' = & gt; 'employer id', 'type' = & gt; 'raw', 'value' = & gt; 'CHtml :: coder ('Created on' ('style' = & gt; width: 90px; ',' square '=> gtz' '), //' filter '=> (' ('name' = & gt; , 'Type' = & gt; 'raw', 'value' = & gt; 'CHtml :: coder (date ("(' style '= & gt; width: 90px;', 'square' = ' & Gt; 'zzz'), //), 'html', '' MDY '' StrawTom ($ data-> created)), 'htmlOptions' = & gt; 'filter' = & gt; filter box to hide 'wrong' / *), array ('name' = & gt; 'Account name', 'type' = & gt; raw, 'value' = & gt; 'CHtml :: encoded ($ data- & gt; name)', 'htmlOptions' = & gt; array (' style '' 'Incorrect' / *) to hide the filter box, 'Array' ('name' = & gt; 'width: 90px;', 'class' =>, 'zzz'), // 'filter' = & = & Gt; 'email', 'type' = & gt; 'raw', 'value' = & gt; 'CHtml :: encoded ($ data-> Email) ',' htmlOptions' = & gt; Array ('style' = & gt; width: 90px; ',' class' => gt; zzz), // 'filter' = & gt; 'Incorrect' / *,) ('name' = & gt; '' Last active on '', 'type' = & gt; 'raw', 'value' = & gt; 'CHtml :: to prevent filter box hidden. ('Style' = & gt; 'width: 90px;', 'class' = & amp; ('' Zzz ''), // 'filter' = & gt; 'wrong' / * *) to hide the filter box, array ('class' = & gt; 'CBTToncolm', 'delete confirmation' = & gt; 'Are you sure you want to get this item?', 'Template' = & gt; '{view} {delete}', 'button' = & gt; The queen ('View' = & gt; array ('label' = & gt; 'view', 'url' = & gt; 'Yii: app () -> Controller- & gt; createUrl ("ViewEmployerActivity" , Array ("id" = '[' id ']))'), 'delete' = & gt; array ('label' = & gt; 'delete', 'url' = & gt; 'Yii :: app () -> Controller-> CreateUrl ("DeleteEmployer", array ("id" => $ data ["id"])))),))))),)); ? & Gt; & Lt; / Tbody & gt; & Lt; / Table & gt;
Redirection in administrator action
Yii :: Application () - & gt; Db- & gt; CreateCommand ($ query) - & gt; Executed (); $ This- & gt; Redirect (array ('Admin'))
Comments
Post a Comment