Telerik Forums
UI for Blazor Forum
1 answer
293 views
I am trying to figure out how I can put a Grid in a dropdown panel (essentially a DropDownList, but the dropdown panel contains a full grid rather than just the list).  It does not look like DropDownList supports a custom template for the entire dropdown.  Is there a Kendo component that could be used to do this?
Marin Bratanov
Telerik team
 answered on 12 Mar 2022
0 answers
201 views

Hello!

I am wondering if the new FormEditorType approach for automatic form generation could be extended in order to support more input types like ColorPicker for example? 


Thanks.

 

Blazorist
Top achievements
Rank 2
Bronze
Iron
Iron
 asked on 11 Mar 2022
2 answers
2.8K+ views

We have data coming from an API endpoint that handles paging, filtering, and sorting, so we are using manual data source operations through OnRead.

All of the documentation examples show this pattern 

protected async Task OnRead(GridReadEventArgs args) { var result = await FetchData(args.Request.Page, args.Request.PageSize);

args.Data = result.Data; args.Total = result.TotalCount; }

This is not a usable pattern for us.  We dispatch api calls using a Redux/Flux pattern (Fluxor library).  Here is a trimmed down version of what we are doing

<TelerikGrid @* Data=CaseState.Value.Cases // since 3.x does nothing if using OnRead *@
             @*  TotalCount=CaseState.Value.TotalCount // not available since 3.x*@
               PageSize=100
               Pageable=true
               Sortable=true 
               Resizable=true
               Reorderable=true
               OnRead=@OnRead
               Width="100%"
               @ref=_grid>
<GridColumns>
...
</GridColumns>

</TelerikGrid>

Code behind:

...

[Inject] private IState<CaseState> CaseState { get; set; } = default!; ... protected void OnRead(GridReadEventArgs args) { var pageRequest = CreateRequestFromArgs(args); // This is a void method and returns immediately Dispatcher.Dispatch(new GetCaseListAction() { SearchRequest = pageRequest }); }

When the api call returns (handled elsewhere) another action is dispatched to the store which updates the CaseState (which in turn triggers StateHasChanged() for the component).

Prior to 3.x we used to be able to pass the collection to the Data parameter AND make use of OnRead.  This is no longer possible and results in a NullReferenceException because the Data is not being set on the GridReadEventArgs.

I looked at using GridState as it contains some of paging, filtering, and sorting info, but not the Total Count or the actual data.  Is there a way to pass Data, TotalCount and the rest of the state in one place either declaratively through component parameters or programmatically via a component ref?

Ecofip
Top achievements
Rank 1
Iron
 updated answer on 11 Mar 2022
0 answers
79 views

Delete this. I had a class on it that was causing the problem

 

Take a look at the picture. The clear content cross is at the left

Martin Herløv
Top achievements
Rank 2
Bronze
Iron
Iron
 updated question on 11 Mar 2022
1 answer
129 views

I am trying to add something like

<a href="#" onclick="doSomething()">do something</a>

Svetoslav Dimitrov
Telerik team
 answered on 11 Mar 2022
1 answer
121 views

Hello,

I am currently working on grids with a server side pager system.
https://docs.telerik.com/blazor-ui/components/grid/manual-operations

Recently I wanted to add multiple line selection but with the server side pager I can't get a correct behavior.

My SelectedItems variable which contains the list of selected items keeps the selected items despite the change of page but on the other hand when I come back to a page with selected items, the checkboxes are not checked.
In addition I can reselect them which adds them several times in my list.

Do you have an example of a server-side paging system with multiple line selection?

 

Marin Bratanov
Telerik team
 answered on 10 Mar 2022
1 answer
207 views
I need the accept="images/*" attribute in the generated file upload by using TelerikUpload. How can I do this?
Marin Bratanov
Telerik team
 answered on 10 Mar 2022
1 answer
592 views

Hello everyone, I hope you are good.

In our application we use the Flux approach, with Fluxor library.

Before the 3.0.0 version release, we had no issue to use the Grid component with server side pagination while using Flux. To simplify, let's imagine that we use only one Store, with one simple state :

public record HouseState(List<HouseSimple> Houses, int TotalCount)

In grids components, we used to:

  • Bind "Data" parameter to the "Houses" field of the state
  • Bind the "TotalCount" parameter to the "TotalCount" field of the state
  • Bind this callback:
protected void ReadItems(GridReadEventArgs args) {
  var page = args.Request.Page;
  var filters = args.Request.Filters;
  var sorts = args.Request.Sorts;

  dispatcher.Dispatch(new LoadHouseAction(page, filters, sorts));
}

As you can see, we get all required information (page, skip etc.), then we dispatch the action. The action will perform an API call, and will create another state with new received data.

<TelerikGrid Data="@State.Houses"
             TotalCount="@State.TotalCount"
             OnRead="@ReadItems">

After migration of Telerik 3.0.0

We cannot use the "TotalCount" parameter anymore. So we need to use the OnRead event, in order to set the TotalCount in it. In the documentations, all examples are like :

protected async Task ReadItems(GridReadEventArgs args)
    {
        DataEnvelope DataResult = await FetchPagedData(args.Request.Page, args.Request.PageSize);

        args.Data = DataResult.CurrentPageData;
        args.Total = DataResult.TotalItemCount;
    }

This approach is made to be used with a classic approach to "ask and wait the data". It could work perfectly but in the approach that we use (flux pattern) it is more like "ask and save in state the data, and views use state". 

To be able to keep the same functionality of server side pagination, we had to subscribe in our view to the event "the data in the store has been refreshed" and then call the Rebind method of the grid. Something like that:

private void UpdateGridData(AgencesSetAgencesAction action) {
  if (GridRef is null) return;
  GridRef.Rebind();
}

protected void ReadItems(GridReadEventArgs args) {
  var total = this.HousesState.Value..TotaCountl;
  var data = this.HousesState.Value.Items;

  args.Total = total;
  args.Data = data ?? Enumerable.Empty<HouseItem>();
}

It works perfectly, but it seems that we break the Flux approach.

Is there any other way to perform that, while using flux approach or something like it?

Thanks a lot, do not hesitate to ask for some precision. 

// Dylan

Marin Bratanov
Telerik team
 answered on 10 Mar 2022
0 answers
101 views

I am using the radslider and have it oriented horizontally but it displays vertically.  I attached a screenshot below.

 

<div class="column is-half">
<small>Weeks ahead to buy</small><br />
<strong><TelerikSlider @bind-Value="@Value"
   Min="0"
   Max="6"
   SmallStep="1"
   LargeStep="2"
   Width="350px"
   Orientation="SliderOrientation.Horizontal">
</TelerikSlider></strong>
</div>

 

 

 

 

Eddie
Top achievements
Rank 1
 asked on 09 Mar 2022
1 answer
203 views

Is it possible to make the Stepper align left (when there are more then one Stepper) instead of center?

i.e. 

 

Dimo
Telerik team
 answered on 09 Mar 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?