<?
// get data grid namespace
$namespace = $this->dataGrid()->getNamespace();
// data store url
$url = $this->url(
array(
'module' => 'category',
'controller' => 'manage',
'action' => 'index',
'format' => 'json'
)
);
// set up data grid columns
$columns = array(
'title' => array(
'width' => '81%',
'formatter' => $namespace . '.Formatters.title'
),
'entries' => array(
'width' => '10%',
'formatter' => $namespace . '.Formatters.entries'
),
);
if (count($this->actions)) {
$columns[] = $this->dataGrid()->getDefaultActionsColumn();
}
// array with tooltip dialogs attached to the grid columns
$fieldTooltips = array(
array(
'sourceField' => 'description',
'attachField' => 'title',
'aroundNode' => 'span.title'
)
);
// set up footer buttons
$buttons = array();
if ($this->showAddLink) {
$buttons['Add Category'] = array(
'attribs' => array(
'class' => 'add-button',
'onclick' => $namespace . '.Utility.openFormDialog("add");'
)
);
}
print $this->dataGrid(
$namespace,
array(
'gridLabel' => 'categories',
'form' => $this->form,
'url' => $url,
'pageSize' => $this->pageSize,
'actions' => $this->actions,
'columns' => $columns,
'footer' => array(
'buttons' => $buttons
),
'plugins' => array(
'p4cms-dnd' => array(
'module' => 'p4cms.ui.grid.plugins.DnD',
'options' => array(
'dropConfig' => array(
'above' => false,
'below' => false
)
)
)
),
'attribs' => array(
'disableSort' => array('_item', 'entries'),
'fieldTooltips' => $fieldTooltips,
'selectionMode' => "single",
'onMoveRows' => $namespace . '.Actions.onMoveRows.apply(this, arguments); return false;'
)
)
);