本文整理汇总了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);
}
}