Solve the problem that php crashes after paging of yii CGridView when there are too many advanced search options
Source: Internet
Author: User
The reverse import php crashes because there are too many options. In fact, empty options do not need to be added to the paging url. You can put the following code at the bottom of the views/layouts/main. php file to correct the CGridView paging link address. [Html] & lt ;? PhpYii: app ()-& gt; clientScript-& gt; register... "/> <SC reverse-pilot php crashes because there are too many options. In fact, empty options do not need to be added to the paging url. You can put the following code at the bottom of the views/layouts/main. php file to correct the CGridView paging link address. [Html] ClientScript-> registerScript ('pagerhref ', "$ (function () {$ ('. pager '). each (function () {var href = $ (this ). attr ('href '); var page = href. match (// ([\ w] +) _ page \/([0-9] +)/); if (page! = Null) {page = page [1] + '_ page =' + page [2];} else {page = '';} var sort = href. match (// ([\ w] +) _ sort \/([\ w] +)/); if (sort! = Null) {sort = sort [1] + '_ sort =' + sort [2];} else {sort = '';} var fields = $ ('. search-form '). serializeArray (); var data = ''; $. each (fields, function (I, field) {if (field. value! = '') {If (data ='') {data + = field. name + '=' + field. value;} else {data + = '&' + field. name + '=' + field. value ;}}); if (data! = ''& Page! = '') {Page = '&' + page;} if (data! = ''| Page! = '') & Sort! = '') {Sort = '&' + sort;} var url = '". $ this-> createUrl ($ this-> id. '/'. $ this-> action-> id ). "? '+ EncodeURI (data) + page + sort; $ (this). attr ('href', url) ;}); ") ;?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.