我使用了数据表包,它非常有用:https://github.com/stwe/DatatablesBundle。 但是我有一个问题,我有一个带位置的数据表。 我要在房间的select2Filter仅列出部分。 如何在网址(manage_section_list)中传递房间的ID(section.room.id)。
谢谢。
在这里PlaceDatatable.php:
/**
* Builds the datatable.
*
* @param array $options
*/
public function buildDatatable(array $options = array())
{
// TODO: Implement buildDatatable() method.
$this->language->set(array(
'cdn_language_by_locale' => true,
));
$this->ajax->set(array());
$this->options->set(array(
'classes' => Style::BOOTSTRAP_3_STYLE . ' table-responsive',
'individual_filtering' => true,
'individual_filtering_position' => 'head',
'order' => array(array(0, 'asc')),
'order_cells_top' => true,
'length_menu' => array(15, 25, 50, 100),
'page_length' => 15,
'paging_type' => Style::FULL_NUMBERS_PAGINATION
));
$this->features->set(array(
'auto_width' => true,
'defer_render' => false,
'info' => true,
'length_change' => true,
'ordering' => true,
'paging' => true,
'processing' => true,
'scroll_x' => false,
'scroll_y' => '',
'searching' => true,
'state_save' => false
));
$this->columnBuilder
->add('id', Column::class, array(
'title' => '',
'searchable' => false,
'orderable' => true,
))
->add('section.name', Column::class, array(
'title' => 'Section',
'width' => '100%',
'filter' => array(Select2Filter::class,
array(
'search_type' => 'eq',
'cancel_button' => true,
'url' => 'manage_section_list',
),
),
))
->add('number', Column::class, array(
'title' => 'Number',
'width' => '100%',
))
->add('section.room.id', Column::class, array(
'title' => 'Room',
'width' => '100%',
))
;
}`