PDA

View Full Version : سوال در ارتبالط با صفحه بندی gridview در extensiion yiibooster



jionelmessi
پنج شنبه 20 فروردین 1394, 09:09 صبح
با سلام به دوستان
من یه مشکلی برخوردم و گرید ویو
من تمام تنظیمات صفحه بندی رو فعال می کنم ولی pagination ظاهر نمشه اصن برام کسی متونه کمکم کنه خیلی ضروریه
اینم کدامه
grid:


$this->widget(
'booster.widgets.TbExtendedGridView',
array(
'id'=> 'gird-view',
'type' => 'striped bordered',
'dataProvider' => $model->search(),
'filter'=>$model,
'enablePagination' => true,
'template' => "{items}",
'selectableRows' => 2,
'bulkActions' => array(
//declare buttons that do bulk actions
'actionButtons' => array(
array(
'id'=> 'grid-btn-bulk-delete',
'buttonType' => 'button',
'context' => 'danger',
'size' => 'small',
'label' => 'حذف دسته جمعی',
'click' => 'js:function(values){App.bulkRemove(values);}'
),
//and put another button to bulk another actions here...
),
// if grid doesn't have a checkbox column type, it will attach
// one and this configuration will be part of it
'checkBoxColumnConfig' => array(
'name' => 'id',
),
),
'columns' => $gridColumns,



)
);
?>








controller




$model = new Contact('search');
$model->unsetAttributes(); // clear any default values
Contact']))
$model->attributes = $_GET['Contact'];
if(isset($_GET['

$this->pageTitle = 'مدیریت مخاصبین';
$this->bigTitle = 'مدیریت مخاطبین';

$this->render(
'contact/index',
array(
'model' => $model,
'stateModel' => State::model(),
'cityModel' => City::model(),
'part' => 'Contact',
'baseUrl' => Yii::app()->BaseUrl
)
);
}




اینم تابع سرچ مدلم





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

$criteria=new CDbCriteria;

$criteria->join = 'LEFT JOIN
{{city}} `c`
ON
`t`.`city_id` = `c`.`id` ';
$criteria->compare('t.name',$this->name,true);
$criteria->compare('t.family',$this->name,true,'OR');
$criteria->compare('c.name',$this->CityName,true);
$criteria->compare('customer_code',$this->customer_code,true);
$criteria->compare('sex',$this->sex);
$criteria->compare('national_code',$this->national_code,true);
$criteria->compare('birthday',$this->birthday,true);
$criteria->compare('work_phone',$this->work_phone,true);
$criteria->compare('home_phone',$this->home_phone,true);
$criteria->compare('email',$this->email,true);
$criteria->compare('fax',$this->fax,true);
$criteria->compare('mobile',$this->mobile,true);
$criteria->compare('image',$this->image,true);
$criteria->compare('documents',$this->documents,true);
$criteria->compare('education',$this->education);
$criteria->compare('address',$this->address,true);
$criteria->compare('send_email_flag',$this->send_email_flag);
$criteria->compare('send_fax_flag',$this->send_fax_flag);
$criteria->compare('send_mobile_flag',$this->send_mobile_flag);
$criteria->compare('description',$this->description,true);
$criteria->compare('website',$this->website,true);
$criteria->compare('search_tag',$this->search_tag,true);
$criteria->compare('title_id',$this->title_id,true);
$criteria->compare('lead_source_id',$this->lead_source_id,true);
$criteria->compare('marketer_id',$this->marketer_id,true);
$criteria->compare('city_id',$this->city_id,true);
$criteria->compare('post_code',$this->post_code,true);
$criteria->compare('connection_priority',$this->connection_priority,true);

$sort = new CSort;
$sort->attributes = array(
'CityName'=>array(
'desc'=>'c.name DESC',
'asc'=>'c.name ASC',
),
'*'
);

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

}

jionelmessi
شنبه 22 فروردین 1394, 09:43 صبح
سلام واقعا کسی نیست کمک کنه؟ خیلی گیرم

mohsen6500
چهارشنبه 01 شهریور 1396, 12:12 عصر
سلام
توی قسمت template شما این گزینه رو وارد نکردید و برای همین نشون داده نمیشه

'template' => "{items}",
برای اضافه کردن صفحه بندی باید به این صورت تغییرش بدید

'layout' => '{items}{pager}',

موفق باشید