Upgrade from v1.6.1 to v1.7.4

Upgrade from v1.6.1 to v1.7.4

Karl53Karl53 Posts: 72Questions: 29Answers: 0

Updating Editor from v1.6.1 to v1.7.4 breaks my code. I read through the prior release notes and I didn't notice anything that indicated a breaking change except for a new required parameter added to submitSuccess I believe.

Inline editing.

The data is in an array of objects. The row id is an integer.

The code seems to break in preSubmit:

// Get the identifier for the row(s) currently being edited / removed.
var rowModifier = editor.modifier();
// Find the cell that is currently being edited
var positionObj = table.cell(rowModifier).index();
var guiInputStruct = table.row(positionObj.row).data(); // selected row

The guiInputStruct sometimes includes all the object's fields, and other times it doesn't.

The result is, cells do not retain the changes after the edit.

Any pointers as to what changed would be appreciated.

Answers

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    I think it will be the submit option in the form-options object. How are you calling the inline() method please?

    Allan

  • Karl53Karl53 Posts: 72Questions: 29Answers: 0
    edited October 2018
    $('#TVM').on('click', 'tbody td:not(:first-child)', function (e) {
        if ($(this).hasClass('nperiod') && editor.display()) {
            editor.blur(); // !important, assure editor is closed and submitted
        }
        var d = table.row(selectedRow).data();
        if (a = b || c = d ....) {
            //console.log(this);
            editor.inline(this);
        } else if (d.event === '0') {
            // error processing
        }
    });
    
  • Karl53Karl53 Posts: 72Questions: 29Answers: 0
    edited October 2018

    Hi Allan, I now have a better understanding as to why v1.7.4 is not working for me. As mentioned, my logic breaks in the preSubmit().

    In v.1.6.1, the Data parameter contains this:

    Object
    action: "edit"
    data:  fltDebitCredit: "6,666"
    __proto__: Object
    id: "1"
    __proto__: Object
    

    In v.1.7.4, it contains this:

    Object
    action: "edit"
    data: {event: null, dtEventDate: "12/01/2018", fltDebitCredit: "6,666"}
    id: "1"
    __proto__: Object
    

    You can see that the contents of the data field of the Data object parameter has changed. v.1.6.1 contains the field being edited and nothing else. v.1.7.4 contains the field being edited plus data from some of the other cells in the row - but not all all the cells.

    My preSubmit() logic is checking for undefined when a cell was not was edited.

    By the way, is it possible that support for this has been dropped?

    legacyAjax: true

    What changed?

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    No - the legacy option is still supported. It sounds like some of the fields are being detected to have a different value when the form is submitted from when editing was triggered. There is another on going thread about this topic.

    Could you add:

    editor.on( 'initEdit', function ( e, node, data, items, type ) {
      console.log( 'initEdit', JSON.stringify( data ) );
    } );
    editor.on( 'preSubmit', function ( e, data, action ) {
      console.log( 'preSubmit', JSON.stringify( data ) );
    } );
    

    to your page please and let me know what the console shows when you edit a row with this issue and then submit it?

    Thanks,
    Allan

  • Karl53Karl53 Posts: 72Questions: 29Answers: 0

    Allan,

    Here are the results:

    initEdit {"idx":1,"rowNum":2,"event":"2","dtEventDate":"2018-12-01T05:00:00.000Z","fltDebitCredit":"Unknown","iPeriods":180,"pmtFreq":6,"dtEndDate":"2033-11-01T04:00:00.000Z","cmpFreq":null,"specialSeriesType":0,"specialSeriesStruct":null}
    
    preSubmit {"action":"edit","data":{"event":null,"dtEventDate":"12/01/2018","fltDebitCredit":"6,666"},"id":"1"}
    

    Note that my code has not been changed. I was just catching up on the DataTables and Editor updates.

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin

    Thanks. I fear I'm going to need to ask for a link to a test case with this one - are you able to PM me a link to the page?

    Looking back you said:

    The guiInputStruct sometimes includes all the object's fields, and other times it doesn't.

    The guiInputStruct from that code should use contain the data for the row being edited. It should never give any only a subset, unless the data for the row has been reduced to that subset.

    What's the pattern for this error? Does it happen on the second edit of the row? If so, that suggests that the full row information isn't being returned by the server. That is something that is now possible in 1.8.

    Allan

This discussion has been closed.