Duplicate background color disappeared

Duplicate background color disappeared

SamanthaTsangSamanthaTsang Posts: 12Questions: 4Answers: 0

I added a "Duplicate" button into my table, and the background color of the button disappeared. The "Add" button and "Edit" button do not have such problem, but only the "Duplicate" button. How to fix it? Thank you.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    Answer ✓

    I'm assuming your duplicate button is based on this example? If so, the buttons parameter that is passed to the edit() method (as part of the form-options) is where to look:

    buttons: 'Create from existing'
    

    Creates a button without any class. What you want in this case is:

    buttons: {
      text: 'Create from existing',
      className: 'btn btn-primary'
    }
    

    Allan

  • SamanthaTsangSamanthaTsang Posts: 12Questions: 4Answers: 0

    Yes, it works !! Thanks. :)

  • SamanthaTsangSamanthaTsang Posts: 12Questions: 4Answers: 0

    Oh, I replaced the code, but the button I created did not have the duplicate function (it did not work). How can I add the duplicate function to this button?

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin

    Based on the example I linked to, it should just be a case of:

                        editor
                            .edit( table.rows( {selected: true} ).indexes(), {
                                title: 'Duplicate record',
                                buttons: buttons: {
                                  text: 'Create from existing',
                                  className: 'btn btn-primary'
                                }
                            } )
                            .mode( 'create' );
    

    Is that what you've got? If that isn't working - what about it isn't working?

    Allan

  • SamanthaTsangSamanthaTsang Posts: 12Questions: 4Answers: 0

    This is my code. When I press the "Create from existing" button, there is no response, neither I click the keyboard enter button.

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin

    Are there any errors shown in the browser's console? That looks like it should work I think.

    If there are no errors, can you give me a link to the page?

    Allan

Sign In or Register to comment.