jQWidgets Forums

jQuery UI Widgets Forums Grid Select everpresentrow

This topic contains 4 replies, has 2 voices, and was last updated by  Martin 6 years, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Select everpresentrow #103844

    mfair
    Participant

    The documentation for selectcell and selectrow specifies the number parameter is for the row’s bound index. With the everpresentrowposition set to top, I tried setting the row index to 0 and -1 hoping it would select the everpresentrow.

    How do I programmatically select the first cell in the everpresentrow (which I believe isn’t a bound row and is why selectcell and selectrow isn’t working)? I want to do this because the grid is initially empty and I don’t want to force the user to have to place the cursor. I will also programmatically select the first cell after the addrow callback function so the user can quickly add one row after the other without having to place the cursor in the first cell of the everpresentrow every time.

    $(“#Grid”).on(“bindingcomplete”, function (event) {
    $(“#Grid”).jqxGrid(‘sortby’, ‘CheckDate’);

    var grp = $(“#Grid”).jqxGrid(‘getgroup’, 0);
    if (grp == null) {
    $(“#Grid”).jqxGrid(‘insertgroup’, 1, ‘Quarter’);
    }

    $(“#Grid”).jqxGrid(‘expandallgroups’);

    //Select the first cell within the everpresentrow
    $(“#Grid”).jqxGrid(‘selectcell’, -1, ‘CheckNo’);
    });

    Select everpresentrow #103858

    Martin
    Participant

    Hello mfair,

    Yes, you are right. The everpresentrow is not a bound row.
    I would suggest you to select the cell by focusing on its input with jquery.
    Here is an Example.

    Best Regards,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

    Select everpresentrow #103869

    mfair
    Participant

    Thank you Martin…the example helped. I had to add the class jqx-grid-cell-add-new-row to the selector to get it to work for me. For example: $(“#jqxGrid input.jqx-grid-cell-add-new-row”)[0].focus();

    Select everpresentrow #103937

    mfair
    Participant

    With the example you provided I was able to select the first cell of the everpresentrow upon load of the page. I was also able to select the first cell of the everpresentrow after the first row was added. BUT for the second row and every other row added, the first cell is selected and then appears to lose focus. The reason I say this is because the Add/Reset buttons flash beneath the first cell. What other functions/methods/events execute after the addrow callback function has completed (and could possibly “steal” the focus from the first cell)?

    Select everpresentrow #104036

    Martin
    Participant

    Hello mfair,

    I would suggest you to call the focus method in the addrow callback inside a timeOut.
    Here is an Example.

    Best Regards,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.