Declined
Last Updated: 18 Oct 2019 15:39 by ADMIN
shanthu
Created on: 15 May 2019 00:47
Category: Grid
Type: Feature Request
1
TotalCount property should be of type "long" instead of "int"
    <TelerikGrid Data=@theViewModel.RowItems
                                 TotalCount=@theViewModel.TotalRecordCount
                                 Filterable=false
                                 Sortable=true
                                 Pageable=true
                                 EditMode="inline"
                                 PageSize=@theViewModel.PageSize>
                        <TelerikGridEvents>
                            <EventsManager OnRead=@ReadItems></EventsManager>
                        </TelerikGridEvents>
                        <TelerikGridColumns>
                            <TelerikGridColumn Field=@nameof(EmployeeTodo.Text) Title="Title" />
                            <TelerikGridColumn Field=@nameof(EmployeeTodo.CreationDate) Title="Date" />
                        </TelerikGridColumns>
                    </TelerikGrid>
1 comment
ADMIN
Marin Bratanov
Posted on: 15 May 2019 04:37
Hello Shanthu,

The int32 type can accommodate more than 2 billion records, and as such it should suffice. Nevertheless, I am leaving this request open to gather public feedback. It if becomes apparent a lot of people intend to use larger volumes of data, we can change the property type.

To solve the situation you can convert a long to an int in the declaration, or change it in the view model and do that conversion there:

@using Telerik.Blazor.Components.Grid
 
<TelerikGrid Data=@theViewModel.RowItems
             TotalCount=@(Convert.ToInt32(theViewModel.TotalRecordCount))
             Filterable=false
             Sortable=true
             Pageable=true
             EditMode="inline"
             PageSize=@theViewModel.PageSize>
    <TelerikGridEvents>
        <EventsManager OnRead=@ReadItems></EventsManager>
    </TelerikGridEvents>
    <TelerikGridColumns>
        <TelerikGridColumn Field=@nameof(EmployeeTodo.Text) Title="Title" />
        <TelerikGridColumn Field=@nameof(EmployeeTodo.CreationDate) Title="Date" />
    </TelerikGridColumns>
</TelerikGrid>
 
@functions {
    public class EmployeeTodo
    {
        public string Text { get; set; }
        public DateTime CreationDate { get; set; }
    }
 
    public class DataConnector
    {
        public int PageSize { get; set; }
        public IEnumerable<EmployeeTodo> RowItems { get; set; }
        public long TotalRecordCount { get; set; } //consider changing the view model itself as an alternative solution
 
    }
 
    DataConnector theViewModel { get; set; } = new DataConnector()
    {
        PageSize = 20,
        RowItems = Enumerable.Range(1, 20).Select(x => new EmployeeTodo() { Text = "text " + x, CreationDate = DateTime.Now.AddDays(-x) }),
        TotalRecordCount = 500
    };
 
    protected async Task ReadItems(GridReadEventArgs args)
    {
        //implement actual data operations here
    }
}


Regards,
Marin Bratanov
Progress Telerik UI for Blazor