Set grid event programmatically?

4 posts, 1 answers
  1. Bob
    Bob avatar
    123 posts
    Member since:
    Sep 2012

    Posted 22 Dec 2014 Link to this post

    Hi, I was wondering how I could programmatically do this in javascript as I want to make a re-usable javascript function for initializing common grid settings:

    .Events(events => events.Change("kendoGridWithCheckboxColumnSelectionOnChange"))
  2. Answer
    Alexander Popov
    Admin
    Alexander Popov avatar
    1436 posts

    Posted 24 Dec 2014 Link to this post

    Hi Bob,

    Attaching event handlers programmatically is done using the bind method. For example: 
    var grid = $("#myGrid").getKendoGrid();
    grid.bind("change", kendoGridWithCheckboxColumnSelectionOnChange);

    Regards,
    Alexander Popov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Thomas
    Thomas avatar
    30 posts
    Member since:
    Jul 2016

    Posted 05 Jul in reply to Alexander Popov Link to this post

    Hi Alexander,

    whats the propper way of binding the data function ? (for setting parametes on the read method).

    So far I have tried:

                this.mainResultGrid = $("#grid").getKendoGrid();


                this.mainResultGrid.bind("data", this._searchParametersForMainGrid);

                this.mainResultGrid.bind("read.data", this._searchParametersForMainGrid);

     

    without success

    thanks

  4. Milena
    Admin
    Milena avatar
    244 posts

    Posted 07 Jul Link to this post

    Hello,

    Please try the code below and verify how it works on your side:
    var grid =$("#myGrid").getKendoGrid().dataSource;
    grid.transport.read.bind("data",this._searchParametersForMainGrid);


    Regards,
    Milena
    Progress Telerik
    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