ParamQuery grid support forum

General Category => Help for ParamQuery Grid (free version) => Topic started by: Belmiris on May 25, 2017, 02:43:26 pm

Title: Focus on row when grid is popped up?
Post by: Belmiris 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?
Title: Re: Focus on row when grid is popped up?
Post by: Belmiris 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.