Multiple DataBound events - Same grid

6 posts, 0 answers
  1. michel
    michel avatar
    11 posts
    Member since:
    Apr 2013

    Posted 05 Aug 2013 Link to this post

    .Events(e => e
                .DataBound("alert('hi 1 ')")
                .DataBound("alert('hi 2')")
            );

    Is it normal that we cant use the fluent eventbuilder with multiple events (same event type) ?

    Kind regards,
    Bart,
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2733 posts
    Member since:
    May 2010

    Posted 06 Aug 2013 Link to this post

    Hello,

    As per your code it will only fire "alert hi 2".
    Because Firstly you have assigned "alert hi 1" then you have overwrite this with "alert hi 2". so it will fired only "alert hi 2".

    Thanks.
    Jayesh Goyani
  3. jeff
    jeff avatar
    2 posts
    Member since:
    Oct 2015

    Posted 16 Apr 2016 Link to this post

    So how can multiple events be assigned to DataBound and fire using the example

    .Events(e => e
                .DataBound("alert('hi 1 ')")
                .DataBound("alert('hi 2')")
            );

  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1961 posts

    Posted 20 Apr 2016 Link to this post

    Hello jeff,

    Multiple DataBound events for same grid is not supported scenario. I would suggest to use one event handler and implement some conditional statement to check and execute the desired code. 

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Nani
    Nani avatar
    2 posts
    Member since:
    Mar 2017

    Posted 12 Apr Link to this post

    HI Jeff,

    For

    .Events(e => e
                .DataBound("alert('hi 1 ')")
                .DataBound("alert('hi 2')")
            );

    I ran into the same problem and I solved it like this. The both functions will be executed.

    .Events(a => a.DataBound(@<text>function(e){  function1(); function2(); }</text>))

     

    In Scripts(same page.cshtml):

    function function1(){

        alert('hi 1 ');

    }

    function function2(){

    alert('hi 2 ');

    }

     

     

  6. Stefan
    Admin
    Stefan avatar
    1025 posts

    Posted 17 Apr Link to this post

    Hello Nani,

    Thank you for sharing a solution with the Kendo UI community.

    This is highly appreciated.

    Regards,
    Stefan
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top