mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
N°5073 - Implements line actions in a datatable (#337)
* datatable row actions
Below is a sample of extra param to enable feature:
$aExtraParams['row_actions'] = [
[
'tooltip' => 'add an element',
'icon_css_class' => 'fa-plus',
'css_class' => 'ibo-is-success',
'level' => 'secondary',
'on_action_js' => 'console.log(aData);',
],
[
'tooltip' => 'remove an element',
'icon_css_class' => 'fa-minus',
'css_class' => 'ibo-is-danger',
'level' => 'secondary',
'on_action_js' => 'console.log("You clicked the remove button");',
],
[
'tooltip' => 'open in new tab',
'icon_css_class' => 'fa-external-link-square-alt',
'on_action_js' => 'window.open("http://localhost/itop-branchs/dev/pages/UI.php?operation=details&class=UserRequest&id=" + aData.id + "&c[menu]=UserRequest%3AOpenRequests");',
],
[
'tooltip' => 'other actions',
'icon_css_class' => 'fa-ellipsis-v',
'on_action_js' => 'console.log(event);',
],
];
* datatable row actions (update)
* datatable row actions (update)
* datatable row actions (add template role)
* datatable row actions (align actions)
* datatable row actions (change template factory make to make standard)
* datatable row actions (use trait to handle row actions)
* datatable row actions (row actions templates)
* datatable row actions (row actions templates)
* datatable row actions (row actions templates)
* datatable row actions (extends to static and form)
* datatable row actions (extends to static and form)
* datatable row actions (code review S)
* datatable row actions (code review S)
* datatable row actions (code review S)
* Update js/dataTables.main.js
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update js/dataTables.main.js
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update sources/Application/UI/Base/Component/DataTable/StaticTable/StaticTable.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update templates/base/components/datatable/row-actions/handler.js.twig
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* datatable row actions (code review M)
* Update js/dataTables.main.js
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update js/dataTables.main.js
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update js/dataTables.main.js
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update sources/Application/UI/Base/Component/DataTable/StaticTable/StaticTable.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update sources/Application/UI/Base/Component/DataTable/StaticTable/StaticTable.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update sources/Application/UI/Base/Component/DataTable/StaticTable/StaticTable.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update js/dataTables.main.js
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update sources/Application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update sources/Application/UI/Base/Component/DataTable/StaticTable/StaticTable.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update application/utils.inc.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* datatable row actions (code review M2)
* datatable row actions (code review M3)
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\DataTable;
|
||||
|
||||
/**
|
||||
* Trait tTableRowActions
|
||||
*
|
||||
* This brings the ability to add action rows to tables.
|
||||
*
|
||||
* @internal
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\DataTable
|
||||
* @since 3.1.0
|
||||
*/
|
||||
trait tTableRowActions
|
||||
{
|
||||
/**
|
||||
* @var $aRowActions array array of row actions
|
||||
* action => {
|
||||
* tooltip: string,
|
||||
* icon_classes: string,
|
||||
* js_row_action: string
|
||||
* }
|
||||
*/
|
||||
protected $aRowActions;
|
||||
|
||||
/**
|
||||
* Set row actions.
|
||||
*
|
||||
* @param array $aRowActions
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetRowActions(array $aRowActions)
|
||||
{
|
||||
$this->aRowActions = $aRowActions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get row actions.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetRowActions(): array
|
||||
{
|
||||
return $this->aRowActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if row actions is set and not empty.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function HasRowActions(): bool
|
||||
{
|
||||
return isset($this->aRowActions) && count($this->aRowActions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return row actions template.
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Template\Template
|
||||
*/
|
||||
public function GetRowActionsTemplate()
|
||||
{
|
||||
return DataTableUIBlockFactory::MakeActionRowToolbarTemplate($this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user