[Controller] Public function actionAjax (){ $ Criteria = new CDbCriteria (); // $ Criteria-> order = 'news _ id DESC '; $ Criteria-> condition = 'User _ id = 1 '; $ DataProvider = new CActiveDataProvider ('news', array ( 'Pagination' => array ( 'Pagesize' => Yii: app ()-> params ['pagesize'], 'Pagevar '=> Yii: app ()-> params ['pagevar'], ), 'Criteria '=> $ criteria, )); $ This-> render ('View', array ( 'Dataprovider' => $ dataProvider, )); } [View] <! --? Php $ This ---> widget ('zii. widgets. Clistview', array ( 'Dataprovider' => $ dataProvider, // data 'Itemview' => '_ view', // displayed Template 'Id' => Yii: app ()-> controller-> id, 'Itemstagname' => 'u ', 'Ajaxvar '=> '', // The default value is page or ajax. 'Htmlopexception' => array ('class' => Yii: app ()-> controller-> id ), 'Loadingcssclass '=> 'loading', // The default value is list-view-loading. // 'Template' => '{summary} {sorter} {items} {pager}', // display order // 'Ajaxupdate' => false, // whether ajax pagination is false or the container id displayed by page // 'Beforeajaxupdat' => 'Before _ ajax_update', // The callback function is completed in common. js. // 'Afterajaxupdate' => 'after _ ajax_update ', 'Emptytext' =>' <DIV class = "alert-waning"> No data! </DIV> ', // Content displayed when no data exists 'Pagercssclass '=> 'pagination', // paging class 'Pager' => array ( 'Selectedpagecssclass '=> 'active', // class on the current page 'Hidenpagecssclass '=> 'disabled', // class of the disabled page 'Header' => '', // the content displayed before the page 'Maxbuttoncount' => 10, // display the number of pages 'Htmlopexception' => array ('class' => ''), 'Firstpagelabel '=> 'homepage ', 'Nextpagelabel '=> 'next page ', 'Prevpagelabel '=> 'previous page ', 'Lastpagelabel '=> 'Last page ', ), )); ?>
|