Yii Framework Forum: How to remove pagination in Tbgridview - Yii Framework Forum

Jump to content

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

How to remove pagination in Tbgridview Rate Topic: -----

#1 User is offline   rrbala123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 97
  • Joined: 19-December 14

Posted 12 March 2015 - 05:24 AM

HI,,

$this->widget('bootstrap.widgets.TbGridView',
array(
'type'=>'striped bordered condensed',
'dataProvider'=>new CArrayDataProvider($model),
'template'=>"{summary}{items}{pager}",
'columns'=>array(
'id',
array('name'=>'bonous_name','header'=>'Bonusnaam'),
'bonus_amount',
'bonous_percentage',
'definition',
)));

Plz tell how to remove pagination in tbgridview,I want show all details in one page,


I wrote in model pagination false please tell what wrong in my code why cant remove pagination,

public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.

$criteria=new CDbCriteria;

$criteria->compare('id',$this->id);
$criteria->compare('product_id',$this->product_id);
$criteria->compare('bonous_name',$this->bonous_name,true);
$criteria->compare('bonus_amount',$this->bonus_amount);
$criteria->compare('bonous_percentage',$this->bonous_percentage);
$criteria->compare('definition',$this->definition,true);
$criteria->compare('category',$this->category,true);
$criteria->compare('category_section',$this->category_section,true);

return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination' => false,
));
}
0

#2 User is offline   Fabrizio Caldarelli 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 995
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 12 March 2015 - 05:27 AM

Where you return CActiveDataProvider, set pagination size to big number.

return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination' => array('pageSize' => 99999999),
));

Yii2 by example: my book about Yii2
https://www.packtpub...nt/yii2-example
0

#3 User is offline   rrbala123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 97
  • Joined: 19-December 14

Posted 12 March 2015 - 06:38 AM

View PostFabrizio Caldarelli, on 12 March 2015 - 05:27 AM, said:

Where you return CActiveDataProvider, set pagination size to big number.

return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination' => array('pageSize' => 99999999),
));



Thanx For ur reply,

I dont know how to remove pagination exactly,Plz tell me solution what i change my coding i can remove

pagination.
0

#4 User is offline   Fabrizio Caldarelli 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 995
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 12 March 2015 - 06:46 AM

If you set pagination as i have written,
you should remove pagination.
Yii2 by example: my book about Yii2
https://www.packtpub...nt/yii2-example
0

#5 User is offline   rrbala123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 97
  • Joined: 19-December 14

Posted 12 March 2015 - 07:00 AM

View PostFabrizio Caldarelli, on 12 March 2015 - 06:46 AM, said:

If you set pagination as i have written,
you should remove pagination.



Hi,
Ya i changed But cant remove pagination.
0

#6 User is offline   Fabrizio Caldarelli 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 995
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 12 March 2015 - 07:04 AM

I read now widget declaration:

$this->widget('bootstrap.widgets.TbGridView',
array(
'type'=>'striped bordered condensed',
'dataProvider'=>new CArrayDataProvider($model),
'template'=>"{summary}{items}{pager}",
'columns'=>array(
'id',
array('name'=>'bonous_name','header'=>'Bonusnaam'),
'bonus_amount',
'bonous_percentage',
'definition',
)));


Here you are redefining 'dataProvider', so you don't get data from search() method.

So you have to set here 'dataProvider' with pageSize attribute,

....

'dataProvider' => new CArrayDataProvider($model, array('pagination' => array('pageSize' => 9999999999))),

...


Yii2 by example: my book about Yii2
https://www.packtpub...nt/yii2-example
0

#7 User is offline   rrbala123 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 97
  • Joined: 19-December 14

Posted 12 March 2015 - 07:12 AM

Hi,

Thanx a lot,Got it..
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