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
190
how to set focus inside a cell on a newly added row
posted

I have a grid where the users add rows by clicking the add button and then type text in the row/cell. I want to set the focus on the newly added cell/row because currently after adding the new row the user again has to click inside the new row/cell for typing his text. Is there a way to set the focus on the newly added row/cell (client side). I tried the following but it didn't worked.

 

function ug_bp_smokeAreas_Grid_AfterRowInsertHandler(gridName, rowId, index)

{

var row = igtbl_getRowById(rowId);

row.getCell(0).select();

row.getCell(0).focus();

}

Parents
No Data
Reply
  • 28464
    posted

    Hello,

    I was able to reproduce your scenario, and with slight modification I was able to get the cell select and then even begin editing automatically. Here is miy event handler:

        <script type="text/javascript">   
       
        function rowInsert(gridName, rowId, index)

       {
            var row = igtbl_getRowById(rowId);
            row.getCell(0).activate();;
            row.getCell(0).beginEdit();
        }
       
        </script>

    Hope this helps. I can send you my complete grid ASPX setup if this will help.

Children