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
240
IgGrid programmatically add a new row and set 1st cell as focused
posted

Hi,

I am using the delegate iggridupdateingedit.  After the user manually adds the first row and presses "Done".  This event fires where I programmatically add a new row.  After I add the new row, iwant that empty new row to have the first column focused.  I cannot programatically figure out how to focus the first call on the newly created row.

Here is the delegate that gets called and creates the row.  It works fine.  Just how do I set focus to it's first cell after creating?  I would think the first step would be setting focus to the row, but that did not work either.

 $(document).delegate("#Mygrid", "iggridupdatingeditrowended", function (evt, ui) {
        $("#Mygrid").igGridUpdating("addRow", { PartNumber: "", BinLoc: "", Count: "" });

          //This selectRow throws exception so I disabled

          // $("#Mygrid").igGridSelection("selectRow", ui.rowID+1);
       
    });

Any help would be appreciated.

Thanks

ARG

Parents
  • 1235
    posted

    Hello Alan,

    There is a method for that in the igGridUpdating, called startAddRowEdit - it starts the editing for the new row and automatically focuses the first cell. Just by itself you will not see Done button, because editRowEnded is fired before the Done button is hidden. What I suggest you to do is use setTimeout method. It should look like this:

    setTimeout(function () {
             $("#Mygrid").igGridUpdating("startAddRowEdit");
            }, 0);

    Please test it yourself and let me know what is the result on your side.

    Regards,
    Ivaylo Hubenov
    Entry-level developer

Reply Children