rowcallback sometimes not fired

rowcallback sometimes not fired

LapointeLapointe Posts: 430Questions: 81Answers: 4

Hi @all
here http://test.appinfo.fr a sample (using user / pass as : NUJBD6DE / NUJBD6DE)

When clicking on row checkbox, sometimes drawcallback is not fired after editor submit

//Field definition :
..., 
{ name: 'utilisateurs.ExoTVA' , label: 'Exonération TVA',
    type: 'checkbox',
    def: 0,
    separator: '|',
        options: [{
            label: '',
        value: 1
    }],
    unselectedValue: 0
},
rowCallback: function ( row, data ) { // display table
    $('input.editor-active-ExoTVA', row).prop( 'checked', data.utilisateurs.ExoTVA == 1 );
},
...

//field reactor
$('#donnees').on( 'change', 'input.editor-active-ExoTVA', function () {
        editor
            .edit( $(this).closest('tr'), false )
            .set( 'utilisateurs.ExoTVA', $(this).prop( 'checked' ) ? 1 : 0 )
            .submit();
} );

To reproduce case, click some times on checkbox, set false, and then dblclick on row, set exotva field value true, save and click again on table checkbox ....
Values displayed may differ between table and editor.

Console log is added...

Thanks
Bobby

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 19,891Questions: 26Answers: 4,691
    Answer ✓

    First place to look is the browser's network inspector. You will see that when the rowCallback is not called there is no ajax request. Using the debugger you will see that the preSubmit event is canceling the submit():

    Apparently openVals equals JSON.stringify( editor.get() ). I'm not sure what you are trying to do but this is where the submit is being cancelled.

    Kevin

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    hi @kevin

    Thanks for your help...

    In fact presubmit allow to close with no save if nothing was changed...

    openVals is set at open event, and click on select box does not fire this event (because edit(false) is called).
    So when submitting, openVals has not been refreshed .

    Clearing openVals on editor close

    .on( 'postRemove close', function () {
        editor.off( 'preClose' );
        openVals=null;
    } );
    

    do the job

    Thanks again
    Regards
    Bobby

This discussion has been closed.