Php yii CActiveDataProvider或TbGridView不适用于分页
我正在使用Yii Booster TbGridView显示来自CActiveDataProvider的数据提供程序。它正在发挥作用,但尚未完全发挥作用。我不知道分页是怎么回事,因为当我从网格中选择其他页面时,它不会返回任何记录。这很奇怪,因为默认情况下分页是10条记录,数据是33条记录,分页创建了4个页面,但我只能看到前10条记录,其他记录在我单击要查看的页面编号后不显示。我只能看到前十张唱片 这是我的密码: 行动(控制员) 小部件:Php yii CActiveDataProvider或TbGridView不适用于分页,php,activerecord,yii,pagination,yii-extensions,Php,Activerecord,Yii,Pagination,Yii Extensions,我正在使用Yii Booster TbGridView显示来自CActiveDataProvider的数据提供程序。它正在发挥作用,但尚未完全发挥作用。我不知道分页是怎么回事,因为当我从网格中选择其他页面时,它不会返回任何记录。这很奇怪,因为默认情况下分页是10条记录,数据是33条记录,分页创建了4个页面,但我只能看到前10条记录,其他记录在我单击要查看的页面编号后不显示。我只能看到前十张唱片 这是我的密码: 行动(控制员) 小部件: $this->widget('bootstrap.wi
$this->widget('bootstrap.widgets.TbButton', array(
'buttonType' => 'button',
'type' => 'primary',
'label' => 'Consultar',
'size' => 'large',
'htmlOptions' => array(
'onClick' => '{ValidacionDatos()}',
'class' => 'btn'
),
));
单击页面链接后,ajax调用是否返回正确的数据?您可以通过查看FireFox-firebug/Chrome-Console中的开发人员工具进行检查。这是ajax调用返回的结果:“No se encontraron resultados。”
class SoporteCasosDocumentacion extends CActiveRecord {
/**
* @return string the associated database table name
*/
public function tableName() {
return 'soporte_casos_documentacion';
}
/**
* @return array validation rules for model attributes.
*/
public function rules() {
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('caso_sistema_info, sistema_informacion, usuario', 'required'),
array('fecha_documentacion, caso_sistema_info, sistema_informacion, usuario', 'length', 'max' => 45),
array('email, celular', 'length', 'max' => 50),
array('informacion_cliente_une', 'length', 'max' => 1),
array('archivo_adjunto, pro_det, sol_dad, ubi_fal, causa, ser_afe, con_aut, cor_ele', 'length', 'max' => 100),
array('tipo_documentacion, tipo_protocolo, tie_sol, tel_con, cel_con', 'length', 'max' => 10),
array('documentacion, error_oci', 'safe'),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('id_doc, fecha_documentacion, caso_sistema_info, sistema_informacion, documentacion, email, celular, informacion_cliente_une, usuario, archivo_adjunto, tipo_documentacion, tipo_protocolo, error_oci, pro_det, sol_dad, ubi_fal, causa, ser_afe, tie_sol, con_aut, cor_ele, tel_con, cel_con', 'safe', 'on' => 'search'),
);
}
/**
* @return array relational rules.
*/
public function relations() {
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array();
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels() {
return array(
'id_doc' => 'Id Doc',
'fecha_documentacion' => 'Fecha Documentacion',
'caso_sistema_info' => 'Caso Sistema Info',
'sistema_informacion' => 'Sistema Informacion',
'documentacion' => 'Documentacion',
'email' => 'Email',
'celular' => 'Celular',
'informacion_cliente_une' => 'Informacion Cliente Une',
'usuario' => 'Usuario',
'archivo_adjunto' => 'Archivo Adjunto',
'tipo_documentacion' => 'Tipo Documentacion',
'tipo_protocolo' => 'Tipo Protocolo',
'error_oci' => 'Error Oci',
'pro_det' => 'Pro Det',
'sol_dad' => 'Sol Dad',
'ubi_fal' => 'Ubi Fal',
'causa' => 'Causa',
'ser_afe' => 'Ser Afe',
'tie_sol' => 'Tie Sol',
'con_aut' => 'Con Aut',
'cor_ele' => 'Cor Ele',
'tel_con' => 'Tel Con',
'cel_con' => 'Cel Con',
);
}
/**
* Retrieves a list of models based on the current search/filter conditions.
*
* Typical usecase:
* - Initialize the model fields with values from filter form.
* - Execute this method to get CActiveDataProvider instance which will filter
* models according to data in model fields.
* - Pass data provider to CGridView, CListView or any similar widget.
*
* @return CActiveDataProvider the data provider that can return the models
* based on the search/filter conditions.
*/
public function search() {
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria = new CDbCriteria;
$criteria->compare('id_doc', $this->id_doc, true);
$criteria->compare('fecha_documentacion', $this->fecha_documentacion, true);
$criteria->compare('caso_sistema_info', $this->caso_sistema_info, true);
$criteria->compare('sistema_informacion', $this->sistema_informacion, true);
$criteria->compare('documentacion', $this->documentacion, true);
$criteria->compare('email', $this->email, true);
$criteria->compare('celular', $this->celular, true);
$criteria->compare('informacion_cliente_une', $this->informacion_cliente_une, true);
$criteria->compare('usuario', $this->usuario, true);
$criteria->compare('archivo_adjunto', $this->archivo_adjunto, true);
$criteria->compare('tipo_documentacion', $this->tipo_documentacion, true);
$criteria->compare('tipo_protocolo', $this->tipo_protocolo, true);
$criteria->compare('error_oci', $this->error_oci, true);
$criteria->compare('pro_det', $this->pro_det, true);
$criteria->compare('sol_dad', $this->sol_dad, true);
$criteria->compare('ubi_fal', $this->ubi_fal, true);
$criteria->compare('causa', $this->causa, true);
$criteria->compare('ser_afe', $this->ser_afe, true);
$criteria->compare('tie_sol', $this->tie_sol, true);
$criteria->compare('con_aut', $this->con_aut, true);
$criteria->compare('cor_ele', $this->cor_ele, true);
$criteria->compare('tel_con', $this->tel_con, true);
$criteria->compare('cel_con', $this->cel_con, true);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
));
}
/**
* @return CDbConnection the database connection used for this class
*/
public function getDbConnection() {
return Yii::app()->Usuarios;
}
/**
* Returns the static model of the specified AR class.
* Please note that you should have this exact method in all your CActiveRecord descendants!
* @param string $className active record class name.
* @return SoporteCasosDocumentacion the static model class
*/
public static function model($className = __CLASS__) {
return parent::model($className);
}
}
$this->widget('bootstrap.widgets.TbButton', array(
'buttonType' => 'button',
'type' => 'primary',
'label' => 'Consultar',
'size' => 'large',
'htmlOptions' => array(
'onClick' => '{ValidacionDatos()}',
'class' => 'btn'
),
));