Editor Button losing styling when editor opened programmatically

Editor Button losing styling when editor opened programmatically

icefieldicefield Posts: 45Questions: 19Answers: 1

Using Bootstrap 4 styling, when the editor is opened via an "Edit" button, the "Update" button in the lower right of the editor has blue color.

When opening an editor for a row using the following code, the "Update" button loses its color, and is grey instead.

    // see https://datatables.net/forums/discussion/comment/118923
    activityTable.on('dblclick', 'tbody tr', function () {
        editorActivity.edit( this, {
            title: 'Edit entry',
            buttons: 'Update'
        } );
    });

I tried to open the editor using the following code too, but couldn't get the editor to open consistently due to row being de-selected on second click of a double-click interaction.

    // see https://datatables.net/forums/discussion/comment/118923
    activityTable.on('dblclick', 'tbody tr', function () {
            activityDataTable.button('editButton:name').trigger()
        } );
    });

Any ideas on getting consistent editor button color regardless of how the editor is opened?

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,118Questions: 1Answers: 2,583
    Answer ✓

    Hi @icefield ,

    You just need to set the class btn-primary for the button, see example here.

    Cheers,

    Colin

  • icefieldicefield Posts: 45Questions: 19Answers: 1

    Perfect. Thank you Colin.

  • icefieldicefield Posts: 45Questions: 19Answers: 1

    Just getting back to implementing, and I noticed that the example you referenced sets the button's color appropriately (blue in this case), but clicking on the button doesn't result in any action occurring.

    I think I need to add an action too in this case, correct? Something along the lines of:

            action: function () {
                this.submit();
          }        
    
  • colincolin Posts: 15,118Questions: 1Answers: 2,583
    Answer ✓

    Ah, yep, that's correct - see here.

This discussion has been closed.