After Added Event

3 posts, 1 answers
  1. Ian
    Ian avatar
    10 posts
    Member since:
    Feb 2012

    Posted 03 May Link to this post

    Is there any way to detect an event AFTER an item has been added to a ListBox? The existing add event fires before the item is added.

    My use case is that I have two connected ListBoxes. The second listbox contains a template that I need to run some jQuery in to modify the contents based on the item data, so the item needs to have been created before the script is run?

  2. Answer
    Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 07 May Link to this post

    Hello Ian,

    Although that there is no specific event that will fire after the rendering of the added item, you could place a setTimeout function within the "add" event and evaluate the template there:
    <script>
        $("#listBoxA").kendoListBox({
            connectWith: "listBoxB",
            toolbar: {
                tools: [ "transferTo" ]
            }
        });
     
        $("#listBoxB").kendoListBox({
            add: function(e) {
                setTimeout(function(){
                  //the custom logic
                })
            }
        });
    </script>


    Best Regards,
    Konstantin Dikov
    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. Ian
    Ian avatar
    10 posts
    Member since:
    Feb 2012

    Posted 07 May in reply to Konstantin Dikov Link to this post

    Ok, that works ok. Thanks.
Back to Top