datatables editor how to close modal programmatically

datatables editor how to close modal programmatically

xfloydxfloyd Posts: 35Questions: 12Answers: 1

Any one knows a way to close editor modal, using JS. I'm using bootstrap and using data-dismiss="modal" or "$('.modal').modal('hide');" does not work. It closes it ok but it will never open again.
Thanks for any help

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Answer ✓

    The close() method should do it.

    Allan

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @xfloyd ,

    Try

    $(".modal").trigger('click');
    

    That should do the trick.

    Cheers,

    Colin

  • xfloydxfloyd Posts: 35Questions: 12Answers: 1

    Hi Colin,

    $(".modal").trigger('click');
    

    That did not do anything in bootstrap 3

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @xfloyd ,

    Have you tried Allan's suggestion above?

    If so, and still no joy, for me, when I go to this example, select a line and press "Edit", a modal dialogue pops up. When I run that command in the console it closes the modal window.

    Could you link to an example of your modal dialogue where this doesn't work, please.

    Cheers,

    Colin

  • xfloydxfloyd Posts: 35Questions: 12Answers: 1

    Hi Colin, Allan's suggestion above did work fine. Thanks for all your help.

This discussion has been closed.