Promise chaining for kendo alert

2 posts, 0 answers
  1. Roohi
    Roohi avatar
    3 posts
    Member since:
    May 2019

    Posted 20 Sep Link to this post

    Hi,

    Does anyone know if it's possible to chain promises on the click of the 'ok' button in kendo.alert(), like you can do with kendo.confirm()?

    If not, is there any other way I can latch on the 'click ok' event for a kendo alert?

    Thanks.

  2. Dimitar
    Admin
    Dimitar avatar
    677 posts

    Posted 24 Sep Link to this post

    Hi Roohi,

    The predefined Kendo Alert dialog does not return a promise. However, you could define the action of the alert and bind a click handler as follows:

    <button id="showAlert">Show Alert</button>
    <div id="alert"></div>
        
    <script>
      $("#showAlert").click(function() {
        showAlert("hi");
      });
          
      function showAlert(message) {
        $("#alert").kendoAlert({
          messages:{
            okText: message
          },
          actions: [{
            text: "#: messages.okText #",
            action: function(e) {             
              console.log("clicked");
            }
          }]
        }).data("kendoAlert").open();
      };
     </script>

    I have also prepared a Dojo example where the above approach is demonstrated:

    I hope this helps. In case you have any additional questions, please let me know.

    Regards,
    Dimitar
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top