mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3750 data-input-type : refresh attribute on AJAX refresh
This commit is contained in:
@@ -2188,7 +2188,6 @@ EOF
|
||||
break;
|
||||
|
||||
case 'ExtKey':
|
||||
$sInputType = ''; // TODO
|
||||
/** @var \AttributeExternalKey $oAttDef */
|
||||
$aEventsList[] = 'validate';
|
||||
$aEventsList[] = 'change';
|
||||
@@ -2451,6 +2450,16 @@ JS
|
||||
$oPage->add_dict_entry('UI:ValueMustBeChanged');
|
||||
$oPage->add_dict_entry('UI:ValueInvalidFormat');
|
||||
|
||||
// N°3750 refresh container data-input-type attribute if in an Ajax context
|
||||
// indeed in such a case we're only returning the field value content and not the parent container, so we need to update it !
|
||||
if (WebPage::IsAjaxPage($oPage)) {
|
||||
$sHTMLValue .= <<<HTML
|
||||
<script>
|
||||
$("[data-input-id='$iId']").data("input-type", "$sInputType");
|
||||
</script>
|
||||
HTML;
|
||||
}
|
||||
|
||||
//TODO 3.0 remove the data-attcode attribute (either because it's has been moved to .field_container in 2.7 or even better because the admin. console has been reworked)
|
||||
return "<div id=\"field_{$iId}\" class=\"field_value_container\"><div class=\"attribute-edit\" data-attcode=\"$sAttCode\">{$sHTMLValue}</div></div>";
|
||||
}
|
||||
|
||||
@@ -1492,4 +1492,8 @@ EOD
|
||||
return $this->sTemplateRelPath;
|
||||
}
|
||||
|
||||
public static function IsAjaxPage(WebPage $oPage)
|
||||
{
|
||||
return ($oPage instanceof AjaxPage);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user