N°2847 - Datatables WIP

This commit is contained in:
Eric
2020-11-16 15:02:02 +01:00
parent 89c35f0345
commit 4c78ecab91
6 changed files with 181 additions and 167 deletions

View File

@@ -45,6 +45,7 @@ class DisplayBlock
protected $m_sStyle;
protected $m_bAsynchronous;
protected $m_aParams;
/** @var \DBObjectSet|null */
protected $m_oSet;
protected $m_bShowObsoleteData = null;
@@ -524,104 +525,11 @@ class DisplayBlock
break;
case 'list_search':
$oBlock = $this->RenderListSearch($aExtraParams, $oPage);
break;
case 'list':
$aClasses = $this->m_oSet->GetSelectedClasses();
$aAuthorizedClasses = array();
if (count($aClasses) > 1)
{
// Check the classes that can be read (i.e authorized) by this user...
foreach($aClasses as $sAlias => $sClassName)
{
if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $this->m_oSet) != UR_ALLOWED_NO)
{
$aAuthorizedClasses[$sAlias] = $sClassName;
}
}
if (count($aAuthorizedClasses) > 0)
{
if($this->m_oSet->CountWithLimit(1) > 0)
{
if (empty($aExtraParams['currentId']))
{
$iListId = $oPage->GetUniqueId(); // Works only if not in an Ajax page !!
}
else
{
$iListId = $aExtraParams['currentId'];
}
$oBlock = DataTableFactory::MakeForObject($oPage, $iListId, $this->m_oSet, $aExtraParams);
}
else
{
// Empty set
$sHtml .= $oPage->GetP(Dict::S('UI:NoObjectToDisplay'));
}
}
else
{
// Not authorized
$sHtml .= $oPage->GetP(Dict::S('UI:NoObjectToDisplay'));
}
}
else
{
// The list is made of only 1 class of objects, actions on the list are possible
if ( ($this->m_oSet->CountWithLimit(1)> 0) && (UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES) )
{
$oBlock = cmdbAbstractObject::GetDisplaySetBlock($oPage, $this->m_oSet, $aExtraParams);
}
else
{
$sHtml .= $oPage->GetP(Dict::S('UI:NoObjectToDisplay'));
$sClass = $this->m_oFilter->GetClass();
$bDisplayMenu = isset($aExtraParams['menu']) ? $aExtraParams['menu'] == true : true;
if ($bDisplayMenu)
{
if ((UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES))
{
$sLinkTarget = '';
$oAppContext = new ApplicationContext();
$sParams = $oAppContext->GetForLink();
// 1:n links, populate the target object as a default value when creating a new linked object
if (isset($aExtraParams['target_attr']))
{
$sLinkTarget = ' target="_blank" ';
$aExtraParams['default'][$aExtraParams['target_attr']] = $aExtraParams['object_id'];
}
$sDefault = '';
if (!empty($aExtraParams['default']))
{
foreach($aExtraParams['default'] as $sKey => $sValue)
{
$sDefault.= "&default[$sKey]=$sValue";
}
}
$sHtml .= $oPage->GetP("<a{$sLinkTarget} href=\"".utils::GetAbsoluteUrlAppRoot()."pages/UI.php?operation=new&class=$sClass&$sParams{$sDefault}\">".Dict::Format('UI:ClickToCreateNew', Metamodel::GetName($sClass))."</a>\n");
}
}
}
if (isset($aExtraParams['update_history']) && true == $aExtraParams['update_history'])
{
$sSearchFilter = $this->m_oSet->GetFilter()->serialize();
// Limit the size of the URL (N°1585 - request uri too long)
if (strlen($sSearchFilter) < SERVER_MAX_URL_LENGTH)
{
$seventAttachedData = json_encode(array(
'filter' => $sSearchFilter,
'breadcrumb_id' => "ui-search-".$this->m_oSet->GetClass(),
'breadcrumb_label' => MetaModel::GetName($this->m_oSet->GetClass()),
'breadcrumb_max_count' => utils::GetConfig()->Get('breadcrumb.max_count'),
'breadcrumb_instance_id' => MetaModel::GetConfig()->GetItopInstanceid(),
'breadcrumb_icon' => 'fas fa-search',
'breadcrumb_icon_type' => iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES,
));
$oPage->add_ready_script("$('body').trigger('update_history.itop', [$seventAttachedData])");
}
}
}
$oBlock = $this->RenderList($aExtraParams, $oPage);
break;
case 'links':
@@ -732,13 +640,8 @@ class DisplayBlock
break;
case 'search':
if (!$oPage->IsPrintableVersion())
{
$aExtraParams['currentId'] = $sId;
$oSearchForm = new SearchForm();
$oBlock = $oSearchForm->GetSearchFormUIBlock($oPage, $this->m_oSet, $aExtraParams);
}
break;
$oBlock = $this->RenderSearch($oPage, $sId, $aExtraParams);
break;
case 'chart':
static $iChartCounter = 0;
@@ -1394,6 +1297,129 @@ JS
}
return $oBlock;
}
/**
* @param \WebPage $oPage
* @param string|null $sId
* @param array $aExtraParams
*
* @return \Combodo\iTop\Application\UI\iUIBlock
*/
protected function RenderSearch(WebPage $oPage, ?string $sId, array $aExtraParams): iUIBlock
{
$oBlock = null;
if (!$oPage->IsPrintableVersion()) {
$aExtraParams['currentId'] = $sId;
$oSearchForm = new SearchForm();
$oBlock = $oSearchForm->GetSearchFormUIBlock($oPage, $this->m_oSet, $aExtraParams);
}
return $oBlock;
}
protected function RenderListSearch(array $aExtraParams, WebPage $oPage)
{
return $this->RenderList($aExtraParams, $oPage);
}
/**
* @param array $aExtraParams
* @param \WebPage $oPage
*
* @throws \ArchivedObjectException
* @throws \ConfigException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DictExceptionMissingString
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
* @throws \ReflectionException
*/
protected function RenderList(array $aExtraParams, WebPage $oPage)
{
$aClasses = $this->m_oSet->GetSelectedClasses();
$aAuthorizedClasses = array();
$oBlock = null;
$sHtml = '';
if (count($aClasses) > 1) {
// Check the classes that can be read (i.e authorized) by this user...
foreach ($aClasses as $sAlias => $sClassName) {
if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $this->m_oSet) != UR_ALLOWED_NO) {
$aAuthorizedClasses[$sAlias] = $sClassName;
}
}
if (count($aAuthorizedClasses) > 0) {
if ($this->m_oSet->CountWithLimit(1) > 0) {
if (empty($aExtraParams['currentId'])) {
$iListId = $oPage->GetUniqueId(); // Works only if not in an Ajax page !!
} else {
$iListId = $aExtraParams['currentId'];
}
$oBlock = DataTableFactory::MakeForObject($oPage, $iListId, $this->m_oSet, $aExtraParams);
} else {
// Empty set
$sHtml .= $oPage->GetP(Dict::S('UI:NoObjectToDisplay'));
}
} else {
// Not authorized
$sHtml .= $oPage->GetP(Dict::S('UI:NoObjectToDisplay'));
}
} else {
// The list is made of only 1 class of objects, actions on the list are possible
if (($this->m_oSet->CountWithLimit(1) > 0) && (UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES)) {
$oBlock = cmdbAbstractObject::GetDisplaySetBlock($oPage, $this->m_oSet, $aExtraParams);
} else {
$sHtml .= $oPage->GetP(Dict::S('UI:NoObjectToDisplay'));
$sClass = $this->m_oFilter->GetClass();
$bDisplayMenu = isset($aExtraParams['menu']) ? $aExtraParams['menu'] == true : true;
if ($bDisplayMenu) {
if ((UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) {
$sLinkTarget = '';
$oAppContext = new ApplicationContext();
$sParams = $oAppContext->GetForLink();
// 1:n links, populate the target object as a default value when creating a new linked object
if (isset($aExtraParams['target_attr'])) {
$sLinkTarget = ' target="_blank" ';
$aExtraParams['default'][$aExtraParams['target_attr']] = $aExtraParams['object_id'];
}
$sDefault = '';
if (!empty($aExtraParams['default'])) {
foreach ($aExtraParams['default'] as $sKey => $sValue) {
$sDefault .= "&default[$sKey]=$sValue";
}
}
$sHtml .= $oPage->GetP("<a{$sLinkTarget} href=\"".utils::GetAbsoluteUrlAppRoot()."pages/UI.php?operation=new&class=$sClass&$sParams{$sDefault}\">".Dict::Format('UI:ClickToCreateNew', Metamodel::GetName($sClass))."</a>\n");
}
}
}
if (isset($aExtraParams['update_history']) && true == $aExtraParams['update_history']) {
$sSearchFilter = $this->m_oSet->GetFilter()->serialize();
// Limit the size of the URL (N°1585 - request uri too long)
if (strlen($sSearchFilter) < SERVER_MAX_URL_LENGTH) {
$seventAttachedData = json_encode(array(
'filter' => $sSearchFilter,
'breadcrumb_id' => "ui-search-".$this->m_oSet->GetClass(),
'breadcrumb_label' => MetaModel::GetName($this->m_oSet->GetClass()),
'breadcrumb_max_count' => utils::GetConfig()->Get('breadcrumb.max_count'),
'breadcrumb_instance_id' => MetaModel::GetConfig()->GetItopInstanceid(),
'breadcrumb_icon' => 'fas fa-search',
'breadcrumb_icon_type' => iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES,
));
$oPage->add_ready_script("$('body').trigger('update_history.itop', [$seventAttachedData])");
}
}
}
if (is_null($oBlock)) {
$oBlock = new Html($sHtml);
}
return $oBlock;
}
}
/**

View File

@@ -487,7 +487,7 @@ JS
if (!$this->m_bDuplicatesAllowed && count($aAlreadyLinkedIds) > 0) {
$oAlreadyLinkedFilter->AddCondition('id', $aAlreadyLinkedIds, 'NOTIN');
$oAlreadyLinkedExpression = $oAlreadyLinkedFilter->GetCriteria();
$sAlreadyLinkedExpression = $oAlreadyLinkedExpression->Render();
$sAlreadyLinkedExpression = $oAlreadyLinkedExpression->RenderExpression();
} else {
$sAlreadyLinkedExpression = '';
}
@@ -505,7 +505,7 @@ JS
array(
'menu' => false,
'result_list_outer_selector' => "SearchResultsToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}",
'table_id' => 'add_'.$this->m_sAttCode,
'table_id' => "add_{$this->m_sAttCode}{$this->m_sNameSuffix}",
'table_inner_id' => "ResultsToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}",
'selection_mode' => true,
'json' => $sJson,
@@ -566,27 +566,7 @@ HTML
$oBlock = new DisplayBlock($oFilter, 'list', false);
$oBlock->Display($oP, "ResultsToAdd_{$this->m_sAttCode}", array('menu' => false, 'cssCount'=> '#count_'.$this->m_sAttCode.$this->m_sNameSuffix , 'selection_mode' => true, 'table_id' => 'add_'.$this->m_sAttCode)); // Don't display the 'Actions' menu on the results
}
/**
* Display one row of the whole form
* @param WebPage $oP
* @param array $aConfig
* @param array $aRow
* @param int $iRowId
* @return string
* @deprecated in 3.0
*/
protected function DisplayFormRow(WebPage $oP, $aConfig, $aRow, $iRowId)
{
$sHtml = '';
$sHtml .= "<tr id=\"{$this->m_sAttCode}{$this->m_sNameSuffix}_row_$iRowId\">\n";
foreach($aConfig as $sName=>$void)
{
$sHtml .= "<td>".$aRow[$sName]."</td>\n";
}
$sHtml .= "</tr>\n";
return $sHtml;
}
/**
* @param WebPage $oP
* @param int $iMaxAddedId
@@ -607,7 +587,6 @@ HTML
if (is_object($oLinkedObj))
{
$aRow = $this->GetFormRow($oP, $oLinkedObj, $iObjectId, array(), $oCurrentObj, $iAdditionId); // Not yet created link get negative Ids
//$oP->add($this->DisplayFormRow($oP, $this->m_aTableConfig, $aRow, -$iAdditionId));
$oRow = new FormTableRow("{$this->m_sAttCode}{$this->m_sNameSuffix}", $this->m_aTableConfig, $aRow, -$iAdditionId);
$oP->AddUiBlock($oRow);
$iAdditionId++;

View File

@@ -7,20 +7,21 @@
namespace Combodo\iTop\Application\UI\Component\DataTable;
use ApplicationException;
use appUserPreferences;
use AttributeLinkedSet;
use CMDBObjectSet;
use cmdbAbstractObject;
use CMDBObjectSet;
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;
use MetaModel;
use appUserPreferences;
use UserRights;
use MenuBlock;
use Combodo\iTop\Application\UI\Layout\UIContentBlock;
use WebPage;
use DBObjectSet;
use Dict;
use MenuBlock;
use MetaModel;
use UserRights;
use WebPage;
/**
* Class DataTableFactory
@@ -67,7 +68,7 @@ class DataTableFactory
/**
* @param \WebPage $oPage
* @param string $sListId
* @param \CMDBObjectSet $oSet
* @param DBObjectSet $oSet
* @param array $aExtraParams
*
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
@@ -81,7 +82,7 @@ class DataTableFactory
* @throws \OQLException
* @throws \ReflectionException
*/
public static function MakeForObject(WebPage $oPage, string $sListId, CMDBObjectSet $oSet, $aExtraParams = array())
public static function MakeForObject(WebPage $oPage, string $sListId, DBObjectSet $oSet, $aExtraParams = array())
{
$oPanel = PanelFactory::MakeForClass($oSet->GetClass(), "Result");
$oDataTable = DataTableFactory::MakeForRenderingObject($sListId, $oSet, $aExtraParams);
@@ -345,7 +346,7 @@ class DataTableFactory
/**
* @param string $sListId
* @param \CMDBObjectSet $oSet
* @param DBObjectSet $oSet
* @param array $aExtraParams
*
* @return \Combodo\iTop\Application\UI\Component\DataTable\DataTableBlock
@@ -355,7 +356,7 @@ class DataTableFactory
* @throws \DictExceptionMissingString
* @throws \MySQLException
*/
public static function MakeForRenderingObject(string $sListId, CMDBObjectSet $oSet, $aExtraParams = array())
public static function MakeForRenderingObject(string $sListId, DBObjectSet $oSet, $aExtraParams = array())
{
$oDataTable = new DataTableBlock('datatable_'.$sListId);
$aList = array();
@@ -476,6 +477,7 @@ class DataTableFactory
if($sSelectMode!="") {
$iIndexColumn++;
}
$aSortDatable = [];
foreach ($aClassAliases as $sClassAlias => $sClassName) {
foreach ($oCustomSettings->aColumns[$sClassAlias] as $sAttCode => $aData) {
if ($aData['sort'] != 'none') {

View File

@@ -7,6 +7,7 @@ use AttributeDashboard;
use AttributeFriendlyName;
use AttributeLinkedSet;
use cmdbAbstract;
use cmdbAbstractObject;
use Dict;
use Metamodel;
use Serializable;
@@ -106,7 +107,7 @@ class DataTableSettings implements Serializable
* @param $bViewLink
* @param $aDefaultLists
*
* @return \DataTableSettings
* @return DataTableSettings
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
@@ -118,7 +119,7 @@ class DataTableSettings implements Serializable
$aColumns = array();
foreach ($aClassAliases as $sAlias => $sClass) {
if ($aDefaultLists == null) {
$aList = cmdbAbstract::FlattenZList(MetaModel::GetZListItems($sClass, 'list'));
$aList = cmdbAbstractObject::FlattenZList(MetaModel::GetZListItems($sClass, 'list'));
} else {
$aList = $aDefaultLists[$sAlias];
}
@@ -189,7 +190,7 @@ class DataTableSettings implements Serializable
* @param null $sTableId
* @param bool $bOnlyOnTable
*
* @return \DataTableSettings|null
* @return DataTableSettings|null
* @throws \Exception
*/
static public function GetTableSettings($aClassAliases, $sTableId = null, $bOnlyOnTable = false)

View File

@@ -65,7 +65,8 @@ class SearchForm
$oPage->AddUiBlock($this->GetSearchFormUIBlock($oPage, $oSet, $aExtraParams));
return '';
}
public function GetSearchFormUIBlock(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array())
public function GetSearchFormUIBlock(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = array())
{
$oUiBlock = new UIContentBlock();
$oAppContext = new ApplicationContext();

View File

@@ -1,9 +1,10 @@
function checkAllDataTable(table, value) {
// Set the 'selectionMode' for the future objects to load
var selectionMode = 'positive';
if (value) {
$(table).DataTable().rows().select();
} else {
$(table).DataTable().rows({page: 'current'}).deselect();
selectionMode = 'negative';
}
// Mark all the displayed items as check or unchecked depending on the value
$(table).find(':checkbox[name^=selectObj]:not([disabled])').each(function () {
var $currentCheckbox = $(this);
@@ -11,15 +12,18 @@ function checkAllDataTable(table, value) {
$currentLine = $currentCheckbox.closest("tr");
(value) ? $currentLine.addClass("selected") : $currentLine.removeClass("selected");
});
// Set the 'selectionMode' for the future objects to load
var selectionMode = 'positive';
if (value) {
selectionMode = 'negative';
}
$(table).parent().parent().find(':input[name=selectionMode]').val(selectionMode);
// Reset the list of saved selection...
$(':input[name^=storedSelection]').remove();
$(table).parent().find(':checkbox[name^=selectObj]').trigger("change");
if (value) {
$(table).DataTable().rows().select();
} else {
$(table).DataTable().rows({page: 'current'}).deselect();
}
return true;
}
@@ -27,8 +31,8 @@ $('#{{ oUIBlock.GetId() }}').closest("[role=dialog]").on("dialogbeforeclose", fu
$('#{{ oUIBlock.GetId() }}').DataTable().clear();
});
{% if oUIBlock.GetOptions()["select_mode"] is defined %}
var oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }} = [];
{% if oUIBlock.GetOption("select_mode") is defined %}
var oSelectedItems{{ oUIBlock.GetOption('sTableId') }} = [];
{% endif %}
if ($.fn.dataTable.isDataTable('#{{ oUIBlock.GetId() }}')) {
@@ -64,19 +68,19 @@ var oTable{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').DataTable({
"order":[],
{% endif %}
"ordering": true,
{% if oUIBlock.GetOptions()["select_mode"] is defined %}
{% if oUIBlock.GetOption("select_mode") is defined %}
"select": {
"style": "{{ oUIBlock.GetOptions()["select_mode"] }}"
"style": "{{ oUIBlock.GetOption("select_mode") }}"
},
"rowCallback": function (oRow, oData) {
// Hiding pagination if only one page
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]') === "negative") {
if (!oData.id in oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }}) {
if (!oData.id in oSelectedItems{{ oUIBlock.GetOption('sTableId') }}) {
$(oRow).select();
$(oRow).find('td:first-child input').prop('checked', true);
}
} else {
if (oData.id in oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }}) {
if (oData.id in oSelectedItems{{ oUIBlock.GetOption('sTableId') }}) {
$(oRow).select();
$(oRow).find('td:first-child input').prop('checked', true);
}
@@ -105,7 +109,7 @@ var oTable{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').DataTable({
"searchable": false,
"sortable": false,
"title":
{% if oUIBlock.GetOption("select_mode") == "multi" %}
{% if oUIBlock.GetOption("select_mode") != "single" %}
'<span class="row_input"><input type="checkbox" onclick="checkAllDataTable(\'#{{ oUIBlock.GetId() }}\',this.checked);" class="checkAll" id="field_{{ oUIBlock.GetId() }}_check_all" name="field_{{ oUIBlock.GetId() }}_check_all" title="{{ 'UI:SearchValue:CheckAll'|dict_s }} / {{ 'UI:SearchValue:UncheckAll'|dict_s }}" /></span>'
{% else %}
'<span class="row_input"><input type="checkbox" style="display: none;" onclick="checkAllDataTable(\'#{{ oUIBlock.GetId() }}\',this.checked);" class="checkAll" id="field_{{ oUIBlock.GetId() }}_check_all" name="field_{{ oUIBlock.GetId() }}_check_all" title="{{ 'UI:SearchValue:CheckAll'|dict_s }} / {{ 'UI:SearchValue:UncheckAll'|dict_s }}" /></span>'
@@ -114,7 +118,7 @@ var oTable{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').DataTable({
"data": "",
"render": function (data, type, row) {
var oCheckboxElem =
{% if oUIBlock.GetOption("select_mode") == "multi" %}
{% if oUIBlock.GetOption("select_mode") != "single" %}
$('<span class="row_input"><input type="checkbox" class="selectList{{ oUIBlock.GetId() }}" name="selectObject[]" /></span>');
{% else %}
$('<span class="row_input"><input type="radio" class="selectList{{ oUIBlock.GetId() }}" name="selectObject[]" /></span>');
@@ -171,16 +175,17 @@ oTable{{ oUIBlock.GetId() }}.off('select').on('select', function (oEvent, dt, ty
// Saving values in temp array
for (var i in aData) {
var iItemId = aData[i].id;
if (!(iItemId in oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }})) {
oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }}.push(iItemId);
if (oSelectedItems{{ oUIBlock.GetOption('sTableId') }}.indexOf(iItemId) === -1) {
oSelectedItems{{ oUIBlock.GetOption('sTableId') }}.push(iItemId);
}
}
if ((oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }}.length === oTable{{ oUIBlock.GetId() }}.page.info()["recordsTotal"] && $(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")) {
$('#btn_ok_{{ oUIBlock.GetOptions()['sTableId'] }}').prop('disabled', true);
if ((oSelectedItems{{ oUIBlock.GetOption('sTableId') }}.length === oTable{{ oUIBlock.GetId() }}.page.info()["recordsTotal"] && $(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")) {
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', true);
} else {
$('#btn_ok_{{ oUIBlock.GetOptions()['sTableId'] }}').prop('disabled', false);
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', false);
}
});
oTable{{ oUIBlock.GetId() }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
var aData = oTable{{ oUIBlock.GetId() }}.rows(indexes).data().toArray();
@@ -189,14 +194,14 @@ oTable{{ oUIBlock.GetId() }}.off('deselect').on('deselect', function (oEvent, dt
// Saving values in temp array
for (var i in aData) {
var iItemId = aData[i].id;
if (iItemId in oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }}) {
oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }}.splice($.inArray(removeItem, oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }}), 1);
if (oSelectedItems{{ oUIBlock.GetOption('sTableId') }}.indexOf(iItemId) > -1) {
oSelectedItems{{ oUIBlock.GetOption('sTableId') }}.splice(oSelectedItems{{ oUIBlock.GetOption('sTableId') }}.indexOf(iItemId), 1);
}
}
if ((oSelectedItems{{ oUIBlock.GetOptions()['sTableId'] }}.length === 0 && $(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "positive")) {
$('#btn_ok_{{ oUIBlock.GetOptions()['sTableId'] }}').prop('disabled', true);
if ((oSelectedItems{{ oUIBlock.GetOption('sTableId') }}.length === 0 && $(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "positive")) {
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', true);
} else {
$('#btn_ok_{{ oUIBlock.GetOptions()['sTableId'] }}').prop('disabled', false);
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', false);
}
});