IgniteUI / igniteui-blazor

Ignite UI for Blazor component library packs 35+ native Blazor UI Controls with 60+ high-performance Charts designed for any Blazor WASM or Server-side app scenario.
https://www.infragistics.com/products/ignite-ui-blazor
3 stars 3 forks source link

Binding the ResourceStrings of the IgbGrid does not work until the grid is interacted with #45

Closed agoldenbaum closed 1 year ago

agoldenbaum commented 1 year ago

Steps to Reproduce

  1. Run the attached sample project.
  2. Click a row of the grid

Actual Behavior After step 2, the resource strings kick in. You can also click the button to assign the Resource Strings, which works.

Expected Behavior The resource strings should show up normally.

It is worth noting that the reason the IgbGridResourceStrings are defined in markup is because defining them programmatically results in a warning that "Component parameter should not be set outside of its component." It appears that IgbGridResourceStrings is currently deriving as a Blazor component, which I'm not sure should be the case?

NewGridBlazorTest.zip

damyanpetev commented 1 year ago

Yeah, cross-assigning @ref'-s really doesn't work like that in Blazor (like it would in Angular):

A component reference is only populated after the component is rendered ... https://learn.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-7.0#capture-references-to-components

So you have to wait to use the ref, and anyway I'd still say the best way is to use a property and new IgbGridResourceStrings and bind that to the grid which works fine. It does indeed log some warnings, that part I leave to @gmurray81 - but I think it's better to ignore those for now than doing the markup gymnastics :)