do not show add/edit dialog if javascript condition not met

do not show add/edit dialog if javascript condition not met

hramoshramos Posts: 3Questions: 1Answers: 0

Great work guys.

I am trying to find how to check a condition on the page (via javascript) before a user tries to add or edit a row to a datatable.

I am thinking the check should be in the editor.on( 'onInitCreate', function(){...}) function.

Within there (if indeed that is where to put it), how do I say: if (false){ "do not continue opening the add/edit window; notify user that the condition has not been met;}

?

Thank you!

Answers

  • hramoshramos Posts: 3Questions: 1Answers: 0

    hello?

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    The open event is the one you want. initCreate and friends do not have the ability to disallow editing - while open does, by returning false.

    Regards,
    Allan

  • hramoshramos Posts: 3Questions: 1Answers: 0

    I'm sorry.. that does not work. I added:
    editor.on("open", function(){
    return false;
    });

    and I can still open any editor (add, edit) I want... :-\

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Sorry - my mistake. I should have linked to preOpen. The open event is triggered after the form has been shown!

    Allan

This discussion has been closed.