Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

semantic-ui modal Close - OK/Cancel Callback

Tags:

semantic-ui

Is it possible to specify callback functions for Ok and Close button?

In case of JQuery Modal one could specify the callback functions at the time of initialization using the buttons dictionary. Does Semantic-ui modeal provide for something similar? How do i go for additional logic and close the model after Ok is pressed?

like image 376
Guddu Avatar asked Mar 05 '15 04:03

Guddu


2 Answers

add a .approve class (or alternative. see http://semantic-ui.com/modules/modal.html#/settings to your 'OK' button to trigger the onApprove callback.

.close class for your Close button.

I have only be using semantic-ui for 2 weeks (and modals for a few hours) so caution required. Thanks mike123 for your answer.

$('.ui.modal.myModal').modal({
        onHide: function(){
            console.log('hidden');

        },
        onShow: function(){
            console.log('shown');
        },
        onApprove: function() {
            console.log('Approve');
            return validateModal()
        }
    }).modal('show');
like image 191
kite_n_code Avatar answered Sep 25 '22 17:09

kite_n_code


Is this what you are after:

    $('.selector').modal({
        onHide: function(){
            console.log('hidden');
        },
        onShow: function(){
            console.log('shown');
        }
    }).modal('show');
like image 28
mike123 Avatar answered Sep 24 '22 17:09

mike123