Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
731
how to add row below in javascript ?
posted

by default single row is displayed in ultrawebgrid now on clicking specific cell i want to create new row how can i do it .??

  • 12333
    posted

    Hello,

     One thing you can try is to handle the following Client Side event of WebGrid along with the following code:

     

    //This event fires whenever a cell enters edit mode.

    function UltraWebGrid1_AfterEnterEditModeHandler(gridName, cellId){

    var theCell = igtbl_getCellById(cellId);

    /* Run this logic on whichever column you want */

    if (theCell.Column.Key == 'ContactTitle') {

    /* Add a new row and get a reference to it */

    var theGrid = igtbl_getGridById(gridName);

    var theNewRow = theGrid.Rows.addNew();

     

    /* If you need, you can modify this row*/

    }

     

    }

     

    Just make sure that your WebGrid is configured to Allow the adding of new records.

    The behavior that your WebGrid using this client side event is as follows:

    Whenever you enter edit mode on the "ContactTitle" cell, a new record will be added to WebGrid.

    This can be modified to be made more specific to your needs. Additionally, you may want to use this logic in another one of WebGrid's many client side events related to cell and row activation.