DataList Move to specific Record

Hi,

is it possible to get a datalist to move to a specific record on load?

I have this and I want to load the page and jump to a specific record (passed into the page) but still allow the user to page through the other records. Page size =1

<RadzenDataList WrapItems="true"  AllowPaging="true" Data="@therapyList" TItem="Therapy" PageSize="1">
        <Template Context="theTherapy">
            <RadzenCard>
...
              </RadzenCard>
        </Template>
    </RadzenDataList>

many thanks
Pete

Hi @Peter_Rogers,

Do you want the DataList to find the page a specific record is in and go there? If yes then I am afraid this isn't possible. Finding the particular page an item is in isn't a trivial task. Perhaps you can sort your items so the item of interest appears on the first page.

Thanks for your quick response, ordering is a good idea, very simple and seems to work well.

Pete

Hello @korchev:

I have a similar problem that I am trying to tackle. I am using RadzenDataList to display a list of records, and the data are sent to the client triggered by the server event. I got the page auto-refresh working, except that it shows the very first record by default. I am wondering whether there is a way to programmatically scroll to the last record in the list, like "clicking >I navigation button from the code behind."?

Thanks for the help!

Frank Z.

Hi,

could you do something like

YourDataList.GoToPage(count);

Where count is the number of pages

Hello @Peter_Rogers:

Thanks for the quick response!
Now, what is "GoToPage()" method? and How can I access it?
Since I would like to achieve this auto-scrolling function from the code behind, no user clicking GUI element required, I was hoping that DataList razor component has some property like "CurrentPage" so I can bind the View Model property to it. Then I can set which page to show from the code.

Is "CurrentPage" a read only property? or it can be set as well from the model binding?

But either way, the "CurrentPage" property is listed on RadzenDataList document, but not in the code. (Radszen version 2.18.9). I am not sure whether this "CurrentPage" property is intended for the purpose I described above? Is it available from the newer version? I would appreciate if Radzen Team could shed some light.

Thanks!
Frank Z.

So in my code I have

<RadzenDataList WrapItems="true" @ref="procedureDataList"

and then in code I have

protected override async Task OnInitializedAsync()
{
procedureDataList.GoToPage(pageNumber);
}

Hello @Peter_Rogers:

Thank you very much for the pointer!
I got it working now. It is great.
I appreciate your help!
Frank Z.

no problem, glad it helped

Pete