Select (click) first row after filtering

Jan 12, 2016 at 3:03 PM
Hello, is there any possibilities to select (click ) first row after filtering or get an pageGrids.MyGrid.AfterFiltering function ?

Thanks for all the Support.
Jan 12, 2016 at 4:33 PM
Can you go a little more in detail regarding what you are after? What are you hoping to achieve by having the first row "be clicked"/"get selected" after a Filter is applied?
Jan 12, 2016 at 5:06 PM
First, sorry for my english.

I have installed grid.mvc and grid.mvc.ajax plugin. The two work so far so good.

I've got a master grid in a partial view with pageGrids.MyGrid.onRowSelect who trigger an ajax call who return others views with grid.
When paging the master grid the whole partial view is reloadded so i can reselect the first line with : $(".grid-row").eq(0).click().
@using GridMvc.Html
@using GridMvc.Sorting
@model Grid.Mvc.Ajax.GridExtensions.AjaxGrid<ComptaFacileConsole.Models.Dossier>
@using ComptaFacileConsole.HtmlHelpers;

    @Html.Grid(Model).SetLanguage("fr").EmptyText("Pas d'élements à afficher").Named("tableDossiers").Columns(columns =>
            {
                columns.Add(d => d.IdDossier).Titled("IdDossier").Css("RubriqueIdDossier");
                columns.Add(d => d.RaisonSociale).Titled("Raison sociale");
                columns.Add(d => d.Siret).Titled("Siret");
                columns.Add(d => d.Adresse).Titled("Adresse");
                columns.Add(d => d.Contact).Titled("Contact");
                columns.Add(d => d.Mail, "email-Dossier").Titled("E-mail");
                columns.Add(d => d.Telephone).Titled("Téléphone");
                columns.Add(d => d.NomTypeUtilisateurBack).Titled("Créé par");
                columns.Add(d => d.Statut).Titled("Activé").Encoded(false).Sanitized(false).RenderValueAs(u => Html.CheckBox("checked", u.Statut, new { @class = "checkbox" }.DisabledIf(true)));
            }).Selectable(true).WithPaging(10).Filterable(true).Sortable(true).WithMultipleFilters() 

<script>
    $(function () {
        $(".grid-mvc").gridmvc();
        //OnRowSelect Grid Dossiers
        pageGrids.tableDossiers.onRowSelect(function (e) {
            $.ajax({
                url: '@Url.Action("Informations_Dossier")',
                cache: false,
                type: 'POST',
                data: { "IdDossier": e.row.IdDossier },
                success: function (data) {
                    $(' #colonne-gauche ').html(data.HtmlComptesBancaire);
                    $(' #colonne-droite ').html(data.HtmlCaisses);
                    $(' #colonne-bas ').html(data.HtmlUtilisateurs);
                },
                error: function (request, error) {
                    if (request.status == 522) window.location.href = request.statusText;
                }
            });
        });
        ////0n selectionne la première ligne de la grid dossier
        if ($('.RubriqueIdDossier').length > 1) $(".grid-row").eq(0).click()
    });
</script>
When filtering, the grid is not fully reloaded and the javascript in my partial view is not reloaded, so the code $(".grid-row").eq(0).click() is not triggered.

Is there any way to reselect properly the first line after filtering and trigger pageGrids.tableDossiers.onRowSelect ?

Thanks for support.
May 13, 2016 at 1:35 PM
I know this is a little older, but I found this to work on paging, sorting, etc. This will select the first row in the grid table. Hopefully it will help someone.
    $(document).ready(function () {
        //Selects the first row in the grid.
        //grid-wrap is a div outside the table
        $(".grid-wrap>table>tbody>tr:first").trigger('click');
    });