We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Move to a specific record

Hi,


Is there any way to move to a specific record in a paging data grid. 

I saw that we could move on a page, scroll in a page. But can we know in which page a record is located in order to be able to move (at least) and scroll to the record if necessary?

I specify that the SearchAsync method is not what I want. I expect a move on the record and not the use of a filter.


Best regards


4 Replies

FF Frederic FOURGEOT January 12, 2023 09:17 AM UTC

I tried to use my own approach

But page changes are visible to the user. I tried to use PreventRender but without success. Page changes are always visible.







NP Naveen Palanivel Syncfusion Team January 16, 2023 05:40 PM UTC

Hi Frederic,


Greetings from Syncfusion support.


From your query, we prepared sample based on your requirement  to move to a specific record from a Grid by navigating to its page and  achieve your requirement using GotoPageAsync(). We also attached the code snippet and sample in this forum


 

    private async Task ValueChangeHandler(Syncfusion.Blazor.Inputs.ChangeEventArgs<int?> args)

    {

        ContinuePaging = true;

        var CurrentPage = Grid.PageSettings.CurrentPage;

        await Grid.GoToPageAsync(CurrentPage);

        var PageCount = Grid.PageSettings.PageCount - 1;

        for (int i = 1; i <= PageCount; i++)

        {

            List<Order> Rows = await Grid.GetCurrentViewRecordsAsync(); // returns the current view data

            for (int j = 0; j < Grid.PageSettings.PageSize; j++)

            {

                if (Rows[j].OrderID == value)

                {

 

                    ContinuePaging = false; // prevent the default navigation

                    break;

                }

            }

            if (ContinuePaging)

            {

                if (i >= PageCount)

                {

                    i = 0;

                }

                await Grid.GoToPageAsync(i + 1);

                await Task.Delay(200);

            }

        }

    }



Please let us know if you have any concerns.


Regards,

Naveen Palanivel


Attachment: SpecificRecord_d82057af.zip


FF Frederic FOURGEOT January 17, 2023 01:21 PM UTC

Ok my code do the same as yours, but page changes are visible with both. 

My question is about whether if it is possible to navigate to a specific row (or data) in the grid without even the multiple page changes. Navigate directly on the row. Or prevent the grid from updating with each page change during the search.



NP Naveen Palanivel Syncfusion Team January 20, 2023 02:11 AM UTC

Hi Frederic,


We have validated your query and currently, we are able to select the records using SelectRow/SelectRows method in the current page(visible rows in the current page). we do not have direct support to achieve your requirement with the grouping feature applied to the grid. We have already considered one requirement “Need to provide support for select records in another page using SelectRows method” a usability improvement feature and logged the improvement report for the same. This feature will be included in any of our upcoming releases. Until then we appreciate your patience.  


You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. 


https://www.syncfusion.com/feedback/22586/need-to-provide-support-for-select-records-in-another-pages-using-selectrows 


While implementing the above requirement we will consider your scenario also (i.e.) with groping enabled in Grid, need to select the records in Grid that are not available on the current page. You can also communicate with us regarding the open feature at any time using our above feedback report page. We do not have an immediate plan to implement this feature and it will be included in any of our upcoming releases. Please cast your vote to make it count so that we will prioritize the improvement for every release based on demands.


We are closing this ticket for now. You can communicate with us regarding the open features at any time using the above Feature Report page.  


Disclaimer: “Inclusion of this solution in the release may change due to other factors including but not limited to QA checks and works reprioritization”


navigate to a specific row (or data) in the grid with the multiple page changes



 we have modified the solution to navigate to required page and select records from any page. Refer the below modified code example.  


private async Task ValueChangeHandler(Syncfusion.Blazor.Inputs.ChangeEventArgs<int?> args)

    {

        ContinuePaging = true;

        var CurrentPage = Grid.PageSettings.CurrentPage;

        await Grid.GoToPageAsync(CurrentPage);

        var PageCount = Grid.PageSettings.PageCount - 1;

        for (int i = 1; i <= PageCount; i++)

        {

            List<Order> Rows = await Grid.GetCurrentViewRecordsAsync(); // returns the current view data

            for (int j = 0; j < Grid.PageSettings.PageSize; j++)

            {

                if (Rows[j].OrderID == value)

                {

                    await Grid.SelectRowAsync(j);

                    ContinuePaging = false; // prevent the default navigation

                    break;

                }

            }

            if (ContinuePaging)

            {

                if (i >= PageCount)

                {

                    i = 0;

                }

                await Grid.GoToPageAsync(i + 1);

                await Task.Delay(200);

            }

        }



Regards,

Naveen Palanivel


Loader.
Up arrow icon