Declined
Last Updated: 03 Dec 2020 12:51 by ADMIN

I'm using the OnRead / OnCreate / OnUpdate / OnDelete events of the TelerikGrid. Most examples do not use OnRead to load data, instead using OnInitializedAsync().

When performing an update two events will fire, such as OnCreate and then OnRead to reload the grid data - which makes sense. The problem is OnRead is not awaited, so in effect the Read method can reload the data prior to data being updated on the server. This is especially the case if I have a JavaScript delete confirmation prompt.

What's my best way forward? Not use OnRead and use OnInitializedAsync instead? Somehow trigger OnRead again (which would effectively trigger it twice)?

Thanks,

Dave

 

Declined
Last Updated: 09 Sep 2020 16:26 by ADMIN

Hello,

When using grid command button edit with the onedit handler shown in this documentation https://docs.telerik.com/blazor-ui/components/grid/editing/inline

There is a bug that causes the grid to reset to the first page when editing the last item on any page that isn't the first. In other words we can edit the last item in the gird on the first page but not on the second, third, fourth...etc. 
I have taken out all the logic in my edit handler as well and the problem still presents itself. 

Below is the relevenat code sample and I have also zipped a short video demonstrating the behavior.

<TelerikGrid @ref="@GridNameHere"
                             Class="smallerFont"
                             Data="@DataHere"
                             Pageable="true"
                             Page="@Page"
                             PageSize="@PageSize"
                             TotalCount="@Total"
                             Sortable="@true"
                             Groupable="@false"
                             FilterMode="@GridFilterMode.FilterMenu"
                             Reorderable="@true"
                             OnEdit="@OnEdit"
                             OnUpdate="@OnUpdate"
                             OnCreate="@OnUpdate">
                    <GridToolBar>
                        <GridCommandButton Command="Add" Icon="add">Add</GridCommandButton>
                    </GridToolBar>
                    <GridColumns>
                        <GridCommandColumn Width="150px">
                            <GridCommandButton Command="Edit" Icon="edit">Edit</GridCommandButton>
                            <GridCommandButton Command="Save" Icon="save" ShowInEdit="true">Save</GridCommandButton>
                            <GridCommandButton Command="Cancel" Icon="cancel" ShowInEdit="true">Cancel</GridCommandButton>
                        </GridCommandColumn>

                        <GridColumn Field="@(nameof(ModelName.FieldName))" Title="Column Name" Width="100px" />

                    </GridColumns>
                </TelerikGrid>

//Handler for edit

 protected void OnEdit(GridCommandEventArgs args)
{

// no code in here and problem still presents itself but feel free to put anything I recommend using the sample from the documentation above

}

Declined
Last Updated: 03 Jul 2020 08:07 by ADMIN
Created by: Shad
Comments: 2
Category: Grid
Type: Bug Report
0

I am using the Telerik UI for Blazor 2.13. The export excel does not work with it. I am using the exact code snippet from docs as below on my test page:

@* You can sort, group, filter, page the grid, resize and reodrder its columns, and you can click the
    Export button to save the current data *@
@page "/test"
@using Telerik.Blazor.Components

<TelerikGrid Data="@GridData" Pageable="true" Sortable="true" Resizable="true" Reorderable="true"
              Groupable="true">

    <GridToolBar>
        <GridCommandButton Command="ExcelExport">Export to Excel</GridCommandButton>
        <label><TelerikCheckBox @bind-Value="@ExportAllPages" />Export All Pages</label>
    </GridToolBar>

    <GridExport>
        <GridExcelExport FileName="telerik-grid-export" AllPages="@ExportAllPages" />
    </GridExport>

    <GridColumns>
        <GridColumn Field="@nameof(SampleData.ProductId)" Title="ID" Width="100px" />
        <GridColumn Field="@nameof(SampleData.ProductName)" Title="Product Name" Width="300px" />
        <GridColumn Field="@nameof(SampleData.UnitsInStock)" Title="In stock" Width="100px" />
        <GridColumn Field="@nameof(SampleData.Price)" Title="Unit Price" Width="200px" />
        <GridColumn Field="@nameof(SampleData.Discontinued)" Title="Discontinued" Width="100px" />
        <GridColumn Field="@nameof(SampleData.FirstReleaseDate)" Title="Release Date" Width="300px" />
    </GridColumns>
</TelerikGrid>

@code {
    List<SampleData> GridData { get; set; }
    bool ExportAllPages { get; set; }

    protected override void OnInitialized()
    {
        GridData = Enumerable.Range(1, 100).Select(x => new SampleData
        {
            ProductId = x,
            ProductName = $"Product {x}",
            UnitsInStock = x * 2,
            Price = 3.14159m * x,
            Discontinued = x % 4 == 0,
            FirstReleaseDate = DateTime.Now.AddDays(-x)
        }).ToList();
    }

    public class SampleData
    {
        public int ProductId { get; set; }
        public string ProductName { get; set; }
        public int UnitsInStock { get; set; }
        public decimal Price { get; set; }
        public bool Discontinued { get; set; }
        public DateTime FirstReleaseDate { get; set; }
    }
}

Whenever I click on the export button. It simply does not respond. I do see lot of http requests though :

 

Please let me know if you need anymore details.

Declined
Last Updated: 05 Jun 2020 07:37 by ADMIN
Created by: Rob
Comments: 1
Category: Grid
Type: Bug Report
0

Grid OnRead .Clear() Issue

With the following component:

@page "/counter"
@using System.Collections.ObjectModel
General grid with its most common features
<TelerikGrid Data="@MyData" Pageable="true" @bind-Page="page" PageSize="5" TotalCount="30" OnRead="@ReadItems" >
    <GridColumns>
        <GridColumn Field="@(nameof(SampleData.Id))" Width="120px" />
        <GridColumn Field="@(nameof(SampleData.Name))" Title="Employee Name" Groupable="false" />
        <GridColumn Field="@(nameof(SampleData.Team))" Title="Team" />
        <GridColumn Field="@(nameof(SampleData.HireDate))" Title="Hire Date" />
    </GridColumns>
</TelerikGrid>

@code {
    public List<SampleData> MyData { get; set; } = new List<SampleData>();
    //public ObservableCollection<SampleData> MyData { get; set; } = new ObservableCollection<SampleData>();
    private int page = 1;

    private void ReadItems(GridReadEventArgs args)
    {
        //MyData = new List<SampleData>();  //OK!
        //MyData = new ObservableCollection<SampleData>(); //OK!
        MyData.Clear();  //List: No update. ObservableCollection: System.StackOverflowException!
        Populate();
        StateHasChanged();
    }

    private void Populate()
    {
        foreach (var data in Enumerable.Range((page - 1) * 5, 5).Select(x => new SampleData
        {
            Id = x,
            Name = "name " + x,
            Team = "team " + x % 5,
            HireDate = DateTime.Now.AddDays(-x).Date
        }))
        {
            MyData.Add(data);
        }
    }

    public class SampleData
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Team { get; set; }
        public DateTime HireDate { get; set; }
    }
}

I see the issues in the comment fields.  Changing OnRead to async makes no difference.  

The workaround is to assign a new List or ObservableCollection instead of using .Clear()

Declined
Last Updated: 04 Jun 2020 07:22 by Daniel

ADMIN EDIT: The issue stems from the data operations in the business logic, and it is not a bug in the component and it does not relate to WebAPI usage.

 

Hi there,

as a follow-up of https://feedback.telerik.com/blazor/1461176-set-specific-position-in-virtual-scrolling-mode we have implemented the suggested skip handling. But there seems an issue when the data is fetched asynchronously, specifically from an Web API.

After hours of debugging and analyzing i have narrowed it down to the following simple Blazor app showcasing the bug:

https://github.com/ViRuSTriNiTy/blazor-app-telerik-grid-skip-bug

Please clone the repo, start the application and follow the steps displayed above the grid to reproduce the bug.

The second skip followed immediatelly after the first one originates from the Telerik assembly hence i cannot investigate it further (no source code).

What are your thoughts? Is it a bug?

So lonG

Daniel

 

 

Declined
Last Updated: 17 Apr 2020 18:59 by ADMIN

TelerikGird with virtual scrolling was working in version 2.7, but after upgrading to 2.10, it is only showing placeholders.

When scrolling, it shows the values for a split second, but then those get replaced by the placeholders.

 

@page "/test"

<TelerikGrid Data=@GridData
             SelectionMode="GridSelectionMode.Single"
             ScrollMode="GridScrollMode.Virtual"
             Height="300px" RowHeight="20">
    <GridColumns>
        <GridColumn Field=@nameof(Employee.Name) />
        <GridColumn Field=@nameof(Employee.Team) Title="Team" />
    </GridColumns>
</TelerikGrid>

@code {
    public List<Employee> GridData { get; set; }

    protected override void OnInitialized()
    {
        GridData = new List<Employee>();
        for (int i = 0; i < 15; i++)
        {
            GridData.Add(new Employee()
            {
                EmployeeId = i,
                Name = "Employee " + i.ToString(),
                Team = "Team " + i % 3
            });
        }
    }

    public class Employee
    {
        public int EmployeeId { get; set; }
        public string Name { get; set; }
        public string Team { get; set; }
    }
}

Declined
Last Updated: 18 Nov 2021 05:40 by Kumar

I have a blazor grid with a large number of columns which I would like to have the width of the page and a horizontal scrollbar to be able to scroll through all of the columns.

According the the documentation I have found (https://demos.telerik.com/blazor-ui/grid/scrolling), setting the width of the grid to 100% and providing widths for the columns which exceed that of the width of the grid/page should cause the horizontal scrollbar to appear. Instead of doing this, however, the grid just expands horizontally to fit all of the columns, no matter what I try. In addition, it appears to be expanding the entire page horizontally to fit itself, as it is increasing the size of all of my bootstrap columns so that it fits within the bootstrap container.

Here is an example of a page containing a grid where I am experiencing this:

 


@page "/admin/users/manageusers"
@inherits ManageUsersBase


<h3>Manage Users</h3>

<WS7.Components.PDAuthorizeBase AllowedRoleIds="ManageAllUsers,ManageAssignedUsers" />
@if (this.Users == null)
{
    <p><em>Loading...</em></p>
}
else
{
    <div class="form-group">
        <label for="UserSearch" class="col-form-label">Search</label>
        <input id="UserSearch" class="form-control" type="search" aria-label="User Search" placeholder="Search" @bind-value="Filter" @bind-value:event="oninput" />
    </div>


    <TelerikGrid Data="@FilteredUsers" TItem="WS7.Engine.Models.ViewModels.ManageUsersViewModel" Height="600px" Width="100%" Pageable="true" PageSize="40" Sortable="true" Groupable="false"
                 FilterMode="GridFilterMode.FilterMenu" Resizable="true" Reorderable="true" OnEdit="EditUser" ScrollMode="@GridScrollMode.Scrollable">
        <GridToolBar>
            <GridCommandButton OnClick="(()=>AddUser())">
                <span class="oi oi-plus"></span> Add
            </GridCommandButton>
        </GridToolBar>
        <GridColumns>
            <GridCommandColumn Width="100px">
                <GridCommandButton Command="Edit" Icon="edit">Edit</GridCommandButton>


            </GridCommandColumn>

            <GridColumn Field="UserName" Title="User Name" Width="500px" />
            <GridColumn Field="Email" Title="Email" Width="500px" />
            <GridColumn Field="FirstName" Title="First Name" Width="500px" />
            <GridColumn Field="LastName" Title="Last Name" Width="500px" />
            <GridColumn Field="AccountStatus" Title="Account Status" Width="500px">
                <Template>
                    @{
                        string toolTip;
                        WS7.Engine.Models.ViewModels.ManageUsersViewModel user = context as WS7.Engine.Models.ViewModels.ManageUsersViewModel;
                        toolTip = "Account Status: " + user.AccountStatus;
                        toolTip += Environment.NewLine + "Active: " + user.Active.ToString();
                        toolTip += Environment.NewLine + "Email Confirmed: " + user.EmailConfirmed.ToString();
                    }
                    <div class="badge badge-pill badge-info">
                        <span class="oi oi-info" data-toggle="tooltip" data-placement="top" title="@toolTip"></span>
                    </div>
                </Template>
            </GridColumn>

            @*<GridCommandColumn Width="90px">
                    <GridCommandButton Command="Delete" Icon="delete">Delete</GridCommandButton>
                </GridCommandColumn>*@
        </GridColumns>
    </TelerikGrid>
}

---

ADMIN EDIT

You can find some more details on  the origin of the issue in the thread below and in the following Knowledge Base article, which also offers a few ideas for solutions to this browser behavior: https://docs.telerik.com/blazor-ui/knowledge-base/grid-bootstrap-flex-width-issue

---

Declined
Last Updated: 14 Jan 2020 07:41 by Christian

We have a Telerik grid which is customized by some CSS rules. The problem is that the header width does not fill the width of the table if no scrollbar is shown.

My question is: Why did you create the table like it is right now in HTML (See screenshot as well)? In my opinion, it would be easier to use something more simple like described here: https://www.w3schools.com/html/html_tables.asp

<table style="width:100%">
  <tr>
    <th>Firstname</th>
    <th>Lastname</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>Jill</td>
    <td>Smith</td>
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td>
    <td>94</td>
  </tr>
</table>

 

This would make it easier to customize the table / grid as well as having no issues with the widths at all. This rectangle on the right top edge doesn't look good...

 

I'm not sure if this is a feature request or just a discussion / idea for the developers :) I just wanted to bring this in and get an explanation why you chose to do it that way (And maybe get a fix for this as well).

 

Best regards,

Christian

Declined
Last Updated: 27 Nov 2019 19:28 by ADMIN
Created by: René
Comments: 2
Category: Grid
Type: Bug Report
3

When clicking on the Add Button in a Grid, a new item is created and displayed in edit mode.

Problem is, the OnEdit event is not triggered.  I need to set a default value for new items and added the code in the OnEditHandler with if(args.IsNew){ //set default value}.

Unfortunately this does not work because the event is not triggered.  This makes me wonder what "args.IsNew" is for if not for the usecase described above.

Declined
Last Updated: 29 Apr 2020 14:02 by ADMIN

 

@GridEditMode.Incell mode does not update automatically on row change when an editortemplate is used, as below

            <GridColumn Field=@nameof(ProjectRankingInfo.Ranking.Option2) Title="@Option2Title" Width="120px" Filterable="false">
                <EditorTemplate>
                    @{
                        currentItem = context as ProjectRankingInfo.Ranking;
                        <TelerikNumericTextBox Max="10" Min="0" Step="1" @bind-Value=@currentItem.Option2 />
                    }
                </EditorTemplate>
            </GridColumn>

 

one must click the update button for the update to occur,

 

Incell works fine and updates on row change for simple grid columns

ADMIN EDIT: SOLUTION: Read the details in the following article: https://docs.telerik.com/blazor-ui/components/grid/editing/incell#notes

ADMIN EDIT: this thread is rather long and I am adding the workaround offered by René here:

<TelerikGrid Data="@GridData" OnUpdate="@UpdateHandler"> ... </TelerikGrid>

 

In GridColumn
-------------------

<EditorTemplate>
   @{
         var item = context as MyModel;
         EditedItem = item;
         <TelerikNumericTextBox @bind-Value="@item.Number" OnChange="OnChangeItemHandler">
         </Telerik.Blazor.Components.TelerikNumericTextBox>
      }
</EditorTemplate>

 

In Code-Section
----------------------

protected MyModel EditedItem { get; set; }

protected void OnChangeItemHandler()
{
       var gridCommandEventArgs = new GridCommandEventArgs
       {
            Item = EditedItem
       };

        UpdateHandler(gridCommandEventArgs);
}

protected void UpdateHandler(GridCommandEventArgs args)
{
       var myModel = (MyModel)args.Item;

      // Save myModel to DB

      .....

}
Declined
Last Updated: 01 Oct 2019 10:04 by ADMIN
Created by: Neil Jackson
Comments: 4
Category: Grid
Type: Bug Report
0

Hi,

I cant see what it is that's causing this error. evertime i run my app, i get the follwoing error below:

An unhandled exception occurred while processing the request.

InvalidOperationException: Object of type 'Telerik.Blazor.Components.Grid.TelerikGrid`1[[BlazorApp1.Core.DTO.AuditEventTypeDTO, BlazorApp1.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' does not have a property matching the name 'ChildContent'.

Microsoft.AspNetCore.Components.Reflection.ComponentProperties.ThrowForUnknownIncomingParameterName(Type targetType, string parameterName

 

My Code:

@page "/Table"

@inject IPurchaseOrderRepository purchaseOrderRepository
@using Telerik.Blazor.Components.Grid
    <h3>Table</h3>

<TelerikGrid Data=@auditEventTypeDTOs>
    <TelerikGridColumn Field="AuditEventName">

    </TelerikGridColumn>
</TelerikGrid>


@code{



    public IEnumerable<AuditEventTypeDTO> auditEventTypeDTOs { get; set; }

    protected override async Task OnInitializedAsync()
    {
        auditEventTypeDTOs = await purchaseOrderRepository.GetAllAuditEventTypes();
    }

}

 

 

The IEnumerable object 'auditEventTypeDTOs' is getting the data from the repository and i've made sure that i don't have any component with the same name within Telerik.blazor namespace.

 

Do let me know if you need me me to supply more information.

 

many thanks in advance

 

George.

Declined
Last Updated: 01 Oct 2019 10:05 by ADMIN

Telerik Blazor version 1.5.0 Trial

Steps to reproduce:

  1. Open a page with a grid in incell edit mode, e.g. https://demos.telerik.com/blazor-ui/grid/editing-incell
  2. Put the cursor in the Name field of the first row and edit the just the Name field, do not click out of the cell or cause it to lose focus, do not edit any other cells first
  3. Press the Add button
  4. The grid will update the dataset and the edit you made is shown in the grid
  5. Press the Add button
  6. Enter the all of the data for the row, but do not press the row's 'Update' button
  7. Press the Add button again
  8. The new data you added is lost

This behaviour is inconsistent as the user is required to press the Update button to save a new row, but not to save changes for an existing row.  Can the grid be made to retain the new row when the Add button is pressed (or can we have that option)?

I think the base issue here is that the new row isn't added automatically when the cell/row loses focus.  The same issue therefore occurs if you press one of the page buttons at the bottom of the grid at step 3 instead.

 

 

Declined
Last Updated: 28 Apr 2019 05:28 by ADMIN
Created by: Mark
Comments: 5
Category: Grid
Type: Bug Report
0

The TelerikGrid never loads any data. the app just hangs. 

I copied the Telerik sample from the online demo. 

 The HTML table loads perfectly.

 Using VS 2019  16.1.0 Preview 2.0.

Acquired Telerik nuget package directly from Telerik feed.

 

 

 

    <TelerikGrid Data=@ViewModel.GetCorePharmacies() Height="300">
        <TelerikGridColumns>
            <TelerikGridColumn Field="ID" Title="NCPDP#" />
            <TelerikGridColumn Field="NPINumber" Title="NPI#" />
            <TelerikGridColumn Field="DBAName" Title="Pharmacy" />
            <TelerikGridColumn Field="StoreNumber" Title="Store#" />
        </TelerikGridColumns>
    </TelerikGrid>

    @*<table class="table">
        <thead>
            <tr>
                <th>NCPDP</th>
                <th>NPI</th>
                <th>DBA Name</th>
                <th>Store#</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var pharmacy in ViewModel.GetCorePharmacies())
            {
                <tr>
                    <td>@pharmacy.ID.ToString()</td>
                    <td>@pharmacy.NPINumber.ToString()</td>
                    <td>@pharmacy.DBAName</td>
                    <td>@pharmacy.StoreNumber</td>
                </tr>
            }
        </tbody>
    </table>*@

 

Any thoughts. 

1 2