本文整理匯總了PHP中CGridView::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP CGridView::getId方法的具體用法?PHP CGridView::getId怎麽用?PHP CGridView::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CGridView
的用法示例。
在下文中一共展示了CGridView::getId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: registerClientScript
public function registerClientScript()
{
if (!Yii::app()->request->isAjaxRequest) {
parent::registerClientScript();
$cs = Yii::app()->clientScript;
$basePath = Yii::getPathOfAlias('ext.NPager.assets');
$baseUrl = Yii::app()->getAssetManager()->publish($basePath);
$id = parent::getId();
$cs = Yii::app()->clientScript;
$cs->registerCoreScript('jquery');
$js = "function {$id}" . "_changePageSize(id,url)\n";
$js .= "{\n";
$js .= " url = {url:url+\$('#'+id+'>.{$this->pagerlistCssClass}>select').val()};\n";
$js .= " \$.fn.yiiGridView.update(id,url);\n";
$js .= "}\n";
$js .= "\n";
$cs->registerScript($this->getId(), $js, CClientScript::POS_END);
$cs->registerCssFile($baseUrl . '/style.css');
}
}
示例2: getId
public function getId($autoGenerate = true)
{
static $hashes = [];
if (parent::getId(false) == null && $autoGenerate) {
// Generate a unique id that does not depend on the number of widgets on the page
// but on the column configuration.
if (isset($this->dataProvider->id)) {
$hash = substr(md5(json_encode($this->columns)), 0, 5) . $this->dataProvider->id;
} else {
$hash = substr(md5(json_encode($this->columns)), 0, 5);
}
while (in_array($hash, $hashes)) {
$hash = substr(md5($hash), 0, 5);
}
$hashes[] = $hash;
$this->setId('dt_' . $hash);
}
return parent::getId($autoGenerate);
}
示例3: getId
public function getId($autoGenerate = true)
{
if (isset($this->dataProvider->modelClass) && $this->genId) {
return strtolower($this->dataProvider->modelClass) . '-grid';
} else {
return parent::getId($autoGenerate);
}
}