Troubleshooting Yii Cgridview PHP crashes after paging over advanced search options
Backward PHP crashes because there are too many options, and the empty option is not added to the paging URL.
The following code can be placed at the bottom of the views/layouts/main.php file to fix the address of the Cgridview page link.
Clientscript->registerscript (' Pagerhref ', "$ (function () {$ ('. Pager a ')." Each (function () {var-href = $ (this). TR (' 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 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); });});");? >