Merge Data regression

Merge Data regression

vipsoftvipsoft Posts: 10Questions: 1Answers: 0
edited May 2020 in Editor

Link to test case:

https://netcentricity.ca/merge-data/

Debugger code (debug.datatables.net):

https://debug.datatables.net/ilemuw

Error messages shown:

none

Description of problem:

Upgrading from Editor 1.7.4, I encountered a regression which I isolated to the "Merge data" feature introduced in 1.8.0 (and continues to exist in 1.9.2).

The above test case is a snapshot of the web page with static responses. "load-promo-code.php" populates the table while "update-promo-code.php" is the response when the "risky_promo_code" checkbox is unchecked.

When unchecked, the ajax response is missing {"value":3,"label":"risky_promo_code"} in the list (i.e., corresponds to the server's deletion). However, the merged data retains the original values, causing the checkbox to be re-checked.

My workaround is to revert the merge.

6860,6865c6860
<               // Merge data to allow for a sub-set to be returned
<               var extender = $.fn.dataTableExt.oApi._fnExtend;
<               var toSave = extender( {}, row.data(), true );
<               toSave = extender( toSave, data, true );
< 
<               row.data( toSave );
---
>               row.data( data );

Replies

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin

    Interesting - thank you for flagging this up. It is related to the fact that your data is in array, but you are attempting to treat each individual array entry as its own separate field, which is why this is a problem.

    For the moment, do the revert as you say - and I'll need to have a think about this. My preference would be for the array to be broken into an object with the name as the key, but you probably don't want to change your data format.

    Allan

  • vipsoftvipsoft Posts: 10Questions: 1Answers: 0

    Yeah, the UI hides the fact that a list is being flattened. At the moment, I can't change the underlying schema or ORM model where the array is a collection of objects.

This discussion has been closed.