Author Topic: Focus on row when grid is popped up?  (Read 2028 times)

Belmiris

  • Newbie
  • *
  • Posts: 2
    • View Profile
Focus on row when grid is popped up?
« on: May 25, 2017, 02:43:26 pm »
I am using the code from the popup demo:

https://paramquery.com/demos/fluid_popup

with row selection.
    selectionModel: { type: 'row' },

I would like for the first row have focus when the grid is popped up. Is that possible?

Belmiris

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Focus on row when grid is popped up?
« Reply #1 on: May 25, 2017, 04:15:25 pm »
I figured something out:
Just add a timer to the button click event.

        $("button#open_popup").button().click(function (evt) {
            $("#popup")
            .dialog({
                height: 400,
                width: 700,
                modal: true,
                open: function (evt, ui) {
                    $("#grid_popup").pqGrid(obj);
                },
                close: function () {
                    $("#grid_popup").pqGrid('destroy');
                },
                show: {
                    effect: "blind",
                    duration: 500
                }
            });

            setTimeout(function () { $("#grid_popup").pqGrid("setSelection", { rowIndx: 0 }); }, 500);
        });         // put .click(); at the end to show the list on page open.