Yii Framework Forum: Error Deleting on CGridView - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Error Deleting on CGridView Rate Topic: -----

#1 User is offline   yineth 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 02-February 11

Posted 22 September 2011 - 11:23 AM

Hi!, I'm working on a GridView but I have a problem when I try to delete a record from delete botton in the grid, only happens on IE, on firefox and chrome works fine!.
I think the problem is when the jquery tries to update the table after deleting the record, because delete the record but sometimes it didn´t update the table correctly or update it with other records that didn´t exist on the database and it was deleted before. I think that could be some cache error but I didn't know where find it and what to modify to fix it.

The controller and model doesn't have something diferent form the base code generated for gii.

I added some screenshots from my app.

I would appreciate every help you could give me.

Before Delete:
Attached File  sinBorrar.jpg (12.44K)
Number of downloads: 19
After Delete:
Attached File  luegoBorrar.jpg (19.11K)
Number of downloads: 18
if I updated with F5:
Attached File  f5Borrar.jpg (12.14K)
Number of downloads: 17
0

#2 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 22 September 2011 - 11:33 AM

I think it could be of great help if you could also show the delete action of your Controller and Model delete function
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#3 User is offline   yineth 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 02-February 11

Posted 22 September 2011 - 01:51 PM

View PostAntonio Ramirez, on 22 September 2011 - 11:33 AM, said:

I think it could be of great help if you could also show the delete action of your Controller and Model delete function



sorry, I forgot that little detail jeje!...

This is the code of my view:
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'proveedor-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
        'pager'=>array(
                'header' => false,
                'class'=>'CLinkPager',
                'nextPageLabel' => '>',
                'prevPageLabel' => '<',
                'firstPageLabel' => '<<',
                'lastPageLabel' => '>>',),
	'columns'=>array(
		'nombre',
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>


and this is the delete action in my controller

public function actionDelete($id)
{
     if(Yii::app()->request->isPostRequest)
     {
	$this->loadModel($id)->delete();

	if(!isset($_GET['ajax']))
	      $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
     else
         throw new CHttpException(400,Yii::app()->params['msg400']);

}


0

#4 User is offline   yineth 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 02-February 11

Posted 22 September 2011 - 03:16 PM

this happens only after the second time that I had tried to delete some record :S
0

#5 User is offline   yineth 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 02-February 11

Posted 23 September 2011 - 09:50 AM

I was testing yesterday and this happen on every gridview I have, and when i´m deleting from the gridview, if someone could help me I would really appreciate it. please!
0

#6 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 23 September 2011 - 03:30 PM

This "problem" is very strange... the code you posted is OK... should be something else...

To be sure it's something in your application... I would suggest you to create a new Yii webapp... and in that one create the CRUD for any table... then check if here is all working...
Find more about me.... btw. Do you know your WAN IP?
0

#7 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 24 September 2011 - 03:08 PM

Wow, strange thing... If IE is actually redirecting to a 'cached' source page... Can you try the following: on the actionDelete, can you include a new parameter to the redirect function that adds a time() value to the end of the URI string? I am curious about its result
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users