Promise chaining for kendo alert

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

    Posted 20 Sep 2019 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
    778 posts

    Posted 24 Sep 2019 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.
  3. Travis
    Travis avatar
    13 posts
    Member since:
    Jul 2013

    Posted 14 Apr in reply to Dimitar Link to this post

    kendo.alert *should* return a promise.

     

    Please add to back log.

     

    Consistency is so import in these types of frameworks.

  4. Dimitar
    Admin
    Dimitar avatar
    778 posts

    Posted 16 Apr Link to this post

    Hello Travis,

    I have logged this as a feature request in the Kendo UI Feedback Portal on your behalf from where you could start tracking its status:

    Also, updated your Telerik points accordingly for submitting this feature request.

    Regards,
    Dimitar
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top