mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-03 15:38:44 +02:00
N°2847 - Datatables for forms
This commit is contained in:
@@ -10,6 +10,7 @@ use ApplicationException;
|
||||
use AttributeLinkedSet;
|
||||
use CMDBObjectSet;
|
||||
use cmdbAbstractObject;
|
||||
use Combodo\iTop\Application\UI\Component\DataTable\StaticTable\FormTable\FormTable;
|
||||
use Combodo\iTop\Application\UI\Component\DataTable\StaticTable\StaticTable;
|
||||
use Combodo\iTop\Application\UI\Component\Panel\PanelFactory;
|
||||
use Combodo\iTop\Application\UI\Component\Title\TitleFactory;
|
||||
@@ -656,4 +657,13 @@ class DataTableFactory
|
||||
|
||||
return $oBlock;
|
||||
}
|
||||
|
||||
public Static function MakeForForm(string $sRef, array $aColumns, array $aData)
|
||||
{
|
||||
$oTable = new FormTable($sRef);
|
||||
$oTable->SetColumns($aColumns);
|
||||
$oTable->SetData($aData);
|
||||
|
||||
return $oTable;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2020 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Component\DataTable\StaticTable\FormTable;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Component\DataTable\StaticTable\StaticTable;
|
||||
|
||||
/**
|
||||
* Class FormTable
|
||||
*
|
||||
* @package Combodo\iTop\Application\UI\Component\FormTable
|
||||
*/
|
||||
class FormTable extends StaticTable
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-formtable';
|
||||
public const HTML_TEMPLATE_REL_PATH = 'components/datatable/static/formtable/layout';
|
||||
public const JS_TEMPLATE_REL_PATH = 'components/datatable/static/formtable/layout';
|
||||
|
||||
/** @var string */
|
||||
private $sRef;
|
||||
|
||||
public function __construct(string $sRef, string $sContainerCSSClass = '')
|
||||
{
|
||||
parent::__construct("dt_{$sRef}", $sContainerCSSClass);
|
||||
$this->SetRef($sRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetRef(): string
|
||||
{
|
||||
return $this->sRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sRef
|
||||
*/
|
||||
public function SetRef(string $sRef): void
|
||||
{
|
||||
$this->sRef = $sRef;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user