N°4481 Fix created elements on 1-n disappearing when table is redrawn

This commit is contained in:
Stephen Abello
2021-12-13 17:00:32 +01:00
parent 1e6a4621ea
commit 4511883baf
3 changed files with 31 additions and 4 deletions

View File

@@ -474,6 +474,33 @@ HTML
}
return $oPage->GetTableRow($aRow, $aAttribs);
}
/**
* @param WebPage $oPage
* @param $sRealClass
* @param $aValues
* @param int $iTempId
*
* @return array
*/
public function GetFormRow($oPage, $sRealClass, $aValues, $iTempId)
{
if ($sRealClass == '')
{
$sRealClass = $this->sLinkedClass;
}
$oLinkObj = new $sRealClass();
$oLinkObj->UpdateObjectFromPostedForm($this->sInputid);
$aAttribs = $this->GetTableConfig();
$aRow = array();
$aRow[] = '<input type="checkbox" class="selectList'.$this->sInputid.'" value="'.($iTempId).'"/>';
foreach($this->aZlist as $sLinkedAttCode)
{
$aRow[] = $oLinkObj->GetAsHTML($sLinkedAttCode);
}
return $aRow;
}
/**
* Initializes the default search parameters based on 1) a 'current' object and 2) the silos defined by the context

View File

@@ -484,9 +484,9 @@ $(function()
this.indicator.html('<img src="../images/indicator.gif">');
$.post(this.options.submit_to, oParams, function(data){
me.datatable.find('tbody').append(data);
// From data variable we get data entry and insert the first (and only) one
me.datatable.DataTable().row.add(data.data[0]).draw();
$('#datatable_'+me.id+' .dataTables_empty').hide();
//$('#linkedset_'+me.id+' .listResults tbody').append(data);
me._updateTable();
me.indicator.html('');

View File

@@ -224,7 +224,7 @@ try
// ui.linksdirectwidget
case 'getLinksetRow':
$oPage->SetContentType('text/html');
$oPage = new JsonPage();
$sClass = utils::ReadParam('class', '', false, 'class');
$sRealClass = utils::ReadParam('real_class', '', false, 'class');
$sAttCode = utils::ReadParam('att_code', '');
@@ -233,7 +233,7 @@ try
$aValues = utils::ReadParam('values', array(), false, 'raw_data');
$oPage->SetContentType('text/html');
$oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId);
$oPage->add($oWidget->GetRow($oPage, $sRealClass, $aValues, -$iTempId));
$oPage->AddData($oWidget->GetFormRow($oPage, $sRealClass, $aValues, -$iTempId));
break;
// ui.linksdirectwidget