FlexGrid ItemSource not updating after initial button click

Posted by: rick.benz on 18 October 2022, 3:38 am EST

  • Posted 18 October 2022, 3:38 am EST

    I’ve created a simple FlexGrid that has an ItemSource that starts out empty and once the user clicks a button the data is obtained but the FlexGrid does not update when the ItemSource is updated. If I click the button a second time, it will update the table. I have a method that will get the users project data and I do have StateHasChanged() in this method.

    I’m not seeing a setting that will update the table upon changes to the itemsource.

    [code]<button class=“btn btn-primary” @onclick=“GetFwUserProjects”>Click me

    <FlexGrid ItemsSource="FwUserProjects"        
            <GridColumn Binding="name" MinWidth="110" Width="GridLength.Star"/>
            <GridDateTimeColumn Binding="created_at" Format="d" Mode="GridDateTimeColumnMode.Date" Header="Created Date"/>                


  • Posted 20 October 2022, 5:48 pm EST

    Hi Rick,

    We are sorry for the inconvenience, but we are unable to replicate the issue at our end. Please refer to the attached sample for reference.


    Manish Gupta


  • Posted 21 October 2022, 1:32 am EST

    Thanks for the example though as I stated the issue is when a user clicks a button it does not load, and in your example you are PRE-LOADING Customer data, which is by-passing the scenario I indicated. I do not want to pre-load data for a page unless it is being called.

    In your example you are pre-loading the customers data with OnInitializedAsync and when you click your example button it works, just like I indicated in my example when I click the button a second time.

    So is this the only way your flexgrid works?

  • Posted 14 May 2023, 3:46 pm EST

    Hi Rick,

    you may also use the following code snippet:

    protected override async Task OnInitializedAsync()
            customers = Customers.GetCustomers(0);

    The following code can also be used:

     IEnumerable<Customers> customers;
        protected override async Task OnInitializedAsync()
            //customers = Customers.GetCustomers(0);
        public void loadData()
            customers = Customers.GetCustomers(5);


    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels