reference Editor data

reference Editor data

montoyammontoyam Posts: 568Questions: 136Answers: 5

I'm thinking there is a more efficient way to get to the Editor's data, but I am not seeing it in the manual.

Right now I'm doing this:

    CaseActionsEditor.field('CaseActions.ActionStatusID').input().on('change', function (e, d) {
        //console.log("D: " + JSON.stringify(d));
        //console.log("E: " + JSON.stringify(e));
        if (d === undefined) { // The change was triggered by the end user on update rather than an auto set
            var actionID = CaseActionsEditor.get("CaseActions.ActionID");
            if (actionID == 1) { //Out for Delivery
                var actionStatusID = CaseActionsEditor.get("CaseActions.ActionStatusID");

but I'm thinking instead of the various CaseActionsEditor.get('fieldName') I could do something like
var data = CaseActionsEditor.data
but I can't find the syntax for something like that.

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,806Questions: 85Answers: 406
    Answer ✓

    https://editor.datatables.net/manual/events#Complex-expressions

    e.g.

    var openVals;
    editor
        .on( 'open', function ( e, type ) {
            openVals = JSON.stringify( editor.get() );
        } )
        .on( 'preBlur', function ( e ) {
            if ( openVals !== JSON.stringify( editor.get() ) ) {
                return confirm( 'You have unsaved changes. Are you sure you want to exit?' );
            }
        } );
    
  • montoyammontoyam Posts: 568Questions: 136Answers: 5

    perfect, thanks. I need to also get in the habit of chaining, like in your example.

This discussion has been closed.