2017-03-20 15 views
0

簡単にするために、私はGridViewを持っており、ページを変更するときに、より多くのパラメータをAjax呼び出しに渡す必要があります。デフォルトのパラメータは、Yii - CGRIDVIEWページングの追加パラメータ

  • 現在のコントローラです。
  • ページ番号;
  • グリッドIDがデフォルトであるajaxVar(デフォルトのajax)。

コントローラが正しいグリッドを再作成するために、より多くのパラメータを必要とするため、より多くのパラメータを渡す必要があります。

Googleでは回答が見つかりませんでした。

アドバイスはありますか?

ありがとうございます!

答えて

0

Yiiは極端に拡張可能なので、カスタムページ付けウィジェットを作成できます。まず、このチュートリアルを見て:

ここ

How to create a Custom Pagination Widget for Yii Framework

は、拡張された改ページにcreatePageButton()関数のために私たちのプロジェクトからの例です:

/** 
* Creates a page button. 
* You may override this method to customize the page buttons. 
* 
* @param string $label the text label for the button 
* @param integer $page the page number 
* @param string $class the CSS class for the page button. This could be 'page', 'first', 'last', 'next' or 'previous'. 
* @param boolean $hidden whether this page button is visible 
* @param boolean $selected whether this page button is selected 
* @return string the generated button 
*/ 
protected function createPageButton($label, $page, $class, $hidden, $selected) { 
    if ($hidden || $selected) 
     $class .= ' ' . ($hidden ? 'disabled' : 'active'); 

    return CHtml::tag('li', array(
     'class' => $class 
    ), CHtml::link($label, $this->createPageUrl($page).'&pageSize='.$this->pageSize)); 
} 

は、次のコードを見てみましょう行:

CHtml::link($label, $this->createPageUrl($page).'&pageSize='.$this->pageSize) 

属性i s &pageSize=とする必要があり、必要なパラメータに拡張することができます。つまり、. '&myParameter=any_parameter'

これは間違いなくあなたの問題を解決する方法であり、お役に立てば幸いです。ご不明な点がございましたら、お気軽にお問い合わせください。

関連する問題