N°4478 Fix linkedset widget in portal when adding new items with already selected ones

Was already committed to develop with e59d472c
This commit is contained in:
Pierre Goiffon
2021-12-10 15:39:49 +01:00
parent 76c139253e
commit 219b970703

View File

@@ -363,7 +363,7 @@ JS
oData.items[i].target_id = oData.items[i].id;
// Adding item to table only if it's not already there
if($('#{$sTableId} tr[role="row"] > td input[data-target-object-id="' + oData.items[i].target_id + '"], #{$sTableId} tr[role="row"] > td input[data-target-object-id="' + (oData.items[i].target_id*-1) + '"]').length === 0)
if($('#{$sTableId} tr[id] > td input[data-target-object-id="' + oData.items[i].target_id + '"], #{$sTableId} tr[id] > td input[data-target-object-id="' + (oData.items[i].target_id*-1) + '"]').length === 0)
{
// Making id negative in order to recognize it when persisting
oData.items[i].id = -1 * parseInt(oData.items[i].id);
@@ -457,7 +457,7 @@ EOF
// Checking removed objects
for(var i in oValues.current)
{
if($('#{$sTableId} tr[role="row"] input[data-object-id="'+i+'"]').length === 0)
if($('#{$sTableId} tr[id="'+i+'"]').length === 0)
{
oValues.remove[i] = {};
}
@@ -492,7 +492,7 @@ EOF
$('#{$sButtonAddId}').off('click').on('click', function(){
// Preparing current values
var aObjectIdsToIgnore = [];
$('#{$sTableId} tr[role="row"] > td input[data-target-object-id]').each(function(iIndex, oElem){
$('#{$sTableId} tr[id] > td input[data-target-object-id]').each(function(iIndex, oElem){
aObjectIdsToIgnore.push( $(oElem).attr('data-target-object-id') );
});
// Creating a new modal