本文整理汇总了PHP中CGridView类的典型用法代码示例。如果您正苦于以下问题:PHP CGridView类的具体用法?PHP CGridView怎么用?PHP CGridView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGridView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWidgetScript
private function getWidgetScript($callback1, $callback2, $callback3, $callback4)
{
Yii::import('zii.widgets.grid.CGridView');
Yii::app()->clientScript->scripts = array();
ob_start();
$widget = new CGridView(null);
$widget->beforeAjaxUpdate = $callback1;
$widget->afterAjaxUpdate = $callback2;
$widget->ajaxUpdateError = $callback3;
$widget->selectionChanged = $callback4;
$widget->dataProvider = new CArrayDataProvider(array(1, 2, 3));
$widget->init();
$widget->registerClientScript();
Yii::app()->clientScript->render($out);
ob_end_clean();
return $out;
}
示例2: renderTableBody
public function renderTableBody()
{
if (!empty($this->mergeColumns) || !empty($this->extraRowColumns)) {
$this->groupByColumns();
}
parent::renderTableBody();
}
示例3: init
/**
* Init the widget
*/
public function init()
{
parent::init();
$classes = array('table');
if ($this->bordered) {
$classes[] = 'table-bordered';
}
if ($this->striped) {
$classes[] = 'table-striped';
}
if ($this->condensed) {
$classes[] = 'table-condensed';
}
EBootstrap::mergeClassString($this->itemsCssClass, $classes);
EBootstrap::mergeClass($this->htmlOptions, array('bootstrap-grid-view'));
switch ($this->pagerAlign) {
case 'centered':
EBootstrap::mergeClassString($this->pagerCssClass, array('pagination-centered'));
break;
case 'right':
EBootstrap::mergeClassString($this->pagerCssClass, array('pagination-right'));
break;
}
if ($this->cssFile === false) {
$cssFile = dirname(__FILE__) . '/css/bootstrap.css';
$this->cssFile = Yii::app()->getAssetManager()->publish($cssFile);
Yii::app()->clientScript->registerCssFile($this->cssFile);
}
}
示例4: init
public function init()
{
$this->displayVar = $this->getId() . 'display';
$this->pageVar = $this->getId() . 'page';
$this->sortVar = $this->getId() . 'sort';
$this->enablePagination = true;
$this->enableSorting = true;
$this->dataProvider->getPagination()->setPageSize(Yii::app()->request->getParam($this->getId() . 'display') ? Yii::app()->request->getParam($this->getId() . 'display') : 50);
$this->dataProvider->getPagination()->pageVar = $this->getId() . 'page';
$display = Yii::app()->request->getParam($this->displayVar);
$this->ajaxUpdate = false;
$this->summaryText = '
<ul>
<li>' . Yii::t('menu', 'Всего') . ': {count}</li>
</ul>';
$data = $this->dataProvider;
$pagerBlock = $data->getTotalItemCount() > 50 ? '<div class="pager-block">
<div class="left">{summary}</div>
<div class="right">{pager}</div>
</div>' : null;
$this->template = '<div class="table-block">{items}</div>' . $pagerBlock;
$this->dataProvider->getSort()->sortVar = $this->sortVar;
$this->pager = array('header' => '', 'cssFile' => '', 'class' => 'MyCLinkPager', 'pageVar' => $this->pageVar, 'displayVar' => $this->displayVar, 'prevPageLabel' => '', 'nextPageLabel' => '', 'maxButtonCount' => '5');
parent::init();
}
示例5: initColumns
/**
* Creates column objects and initializes them.
*/
protected function initColumns()
{
foreach ($this->columns as $i => $column) {
if (is_array($column) && !isset($column['class'])) {
$this->columns[$i]['class'] = '\\TbDataColumn';
}
}
parent::initColumns();
}
示例6: init
public function init()
{
$this->pager = array('class' => 'itemPaginator');
if (Yii::app()->theme->name == 'atlas') {
$this->pager = array('class' => 'itemPaginatorAtlas', 'header' => '', 'selectedPageCssClass' => 'current', 'htmlOptions' => array('class' => ''));
$this->pagerCssClass = 'pagination';
}
parent::init();
}
示例7: init
public function init()
{
$themeUrl = Yii::app()->theme->baseUrl;
$this->cssFile = $themeUrl . '/css/grid.css';
$this->template = '{items}' . "\n" . '{pager}' . "\n" . '{summary}';
//$this->beforeAjaxUpdate = 'js:function(id, data){ alertify.log("loading grid data... please wait..."); }';
//$this->afterAjaxUpdate = 'js:function(id,options){ alertify.log("grid data successfully loaded","success"); }';
return parent::init();
}
示例8: initColumns
/**
* Creates column objects and initializes them.
*/
protected function initColumns()
{
foreach ($this->columns as &$column) {
if (!isset($column['class'])) {
$column['class'] = 'BootDataColumn';
}
}
parent::initColumns();
}
示例9: initColumns
protected function initColumns()
{
parent::initColumns();
if ($this->filter !== null and $this->filterCleanColumn) {
//Adiciona coluna para limpar filtros
$this->htmlOptions['class'] .= ' hasFilter';
$this->addCleanFiltersColumn();
}
}
示例10: init
/**
* Initializes the view.
*/
public function init()
{
if ($this->enablePagination === false) {
$this->dataProvider->setPagination(false);
}
if ($this->enableAlphaPagination && $this->dataProvider->getAlphaPagination() === false) {
$this->enableAlphaPagination = false;
}
parent::init();
}
示例11: renderItems
/**
* Renders the data items for the grid view.
*/
public function renderItems()
{
if ($this->extended && $this->filter) {
$this->insertDropdownHtml();
$this->insertModelAttributes();
}
parent::renderItems();
if ($this->enableCustomActions === true) {
$this->widget('zii.widgets.CMenu', array('id' => $this->getId() . 'Actions', 'htmlOptions' => array('class' => 'gridFooterActions'), 'items' => $this->getCustomActions()));
}
}
示例12: init
public function init()
{
$this->cssFile = false;
$this->rowCssClass = array('row1', 'row2');
$this->pager = array('htmlOptions' => array('class' => 'ui-pagination'), 'cssFile' => false, 'header' => false);
$this->pagerCssClass = 'option';
$this->template = '<div class="table-options">{pager}{summary}<span class="clear"><!-- --></span></div><div class="table full-width">{items}</div><div class="table-options">{pager}{summary}<span class="clear"><!-- --></span></div>';
$this->summaryCssClass = false;
$this->summaryText = 'Результаты <strong class="results-start">{start}</strong>-<strong class="results-end">{end}</strong> из <strong class="results-total">{count}</strong>';
parent::init();
}
示例13: registerClientScript
/**
* Registers necessary client scripts.
* Automaticlly prepend user's beforeajaxUpdate with needed code that will modify GET params when navigating and sorting
*/
public function registerClientScript()
{
parent::registerClientScript();
if ($this->selectableRows > 0) {
$id = $this->getId();
$options = array('selVar' => $this->selVar);
$options = CJavaScript::encode($options);
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($this->selBaseScriptUrl . '/jquery.selgridview.js', CClientScript::POS_END);
$cs->registerScript(__CLASS__ . '#' . $id . '-sel', "jQuery('#{$id}').selGridView({$options});");
}
}
示例14: registerClientScript
/**
* Registers necessary client scripts.
*/
public function registerClientScript()
{
parent::registerClientScript();
$cs=Yii::app()->getClientScript();
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.core.min.js',CClientScript::POS_END);
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.widget.min.js',CClientScript::POS_END);
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.mouse.min.js',CClientScript::POS_END);
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.droppable.min.js',CClientScript::POS_END);
$cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.draggable.min.js',CClientScript::POS_END);
$baseUrl = Y::curBaseUrl();
$cs->registerScript('draganddrop', '
$(document).ready(function() {
$("#'.$this->getId().' tbody tr").live("mouseenter", function() {
var $this = $(this);
if($this.is(":data(draggable)")) return;
$this.draggable({
helper: "clone",
opacity: .75,
refreshPositions: true, // Performance?
revert: "invalid",
revertDuration: 300,
scroll: true
});
});
$("#'.$this->getId().' tbody tr").live("mouseenter", function() {
var $this = $(this);
if ($this.is(":data(droppable)")) return;
$(this).droppable({
drop: function(e, ui) {
$("#'.$this->getId().'").addClass("grid-views-loading");
$.get(
"'.$baseUrl.'/movePosition",
{
pk : $(ui.draggable).attr("id"),
to : $(this).attr("id")
},
function() {
$.fn.yiiGridView.update("'.$this->getId().'");
}
);
},
hoverClass: "accept",
});
});
});
');
}
示例15: init
public function init()
{
$this->title = $this->title ? $this->title : Yii::app()->getController()->getPageTitle();
parent::init();
//Autoload fix
spl_autoload_unregister(array('YiiBase', 'autoload'));
Yii::import('application.extensions.phpexcel.Classes.PHPExcel', true);
$this->objPHPExcel = new PHPExcel();
spl_autoload_register(array('YiiBase', 'autoload'));
// Creating a workbook
$this->objPHPExcel->getProperties()->setCreator($this->creator);
$this->objPHPExcel->getProperties()->setTitle($this->title);
$this->objPHPExcel->getProperties()->setSubject($this->subject);
$this->objPHPExcel->getProperties()->setDescription($this->description);
$this->objPHPExcel->getProperties()->setCategory($this->category);
}