We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid with Observable Collection and Pre-sorted column stops updating

Hello,

I have a grid tied to an observable collection with a pre-sorted column using simple <GridSortSettings>.

I'm adding data in the background and everything works fine until after x number of intervals of loading data and the grid has around 40 something items.  At this point, the grid will no longer show updates.

Without the  <GridSortSettings> it works fine as it adds data to the bottom and you have to scroll down each time which is not desirable at all.  Therefore, I need the new data at the top as to why I am using the sort settings.  Do you know what the issue could be?

My grid sort settings are below. 

Thank you, 

Justin


 <GridSortSettings>

                    <GridSortColumns>

                        <GridSortColumn Field="Column" Direction="SortDirection.Descending"></GridSortColumn>

                    </GridSortColumns>

                </GridSortSettings>


7 Replies 1 reply marked as answer

PS Prathap Senthil Syncfusion Team October 19, 2022 01:09 PM UTC

Hi Justin,


Greetings from Syncfusion support


Query:” I need the new data at the top as to why I am using the sort settings


We analyzed your query, and we would like to inform you that while performing add data will be appended to the grid based on the GridSortSettings of SfGrid.By removing the GridSortSettings data will append to the top of the grid. This is the default behavior grid.

Query:” adding data in the background and everything works fine until after x number of intervals of loading data and the grid has around 40 something items.  At this point, the grid will no longer show updates.”


We have validated your query and we can’t be able to reproduce the reported issue at our end version[20.3.0.50].kindly upgrade to the latest version.


If the reported issue persists, or we misunderstood your query kindly share as the below details validate further at our end.


  1. Share with us the entire Grid code snippet along with the model class.
  2. Share with us the NuGet version used.
  3. Share with us the video demonstration of the issue.
  4. If possible, kindly share with us the simple issue reproducible sample or modify the reported issue on the above-mentioned sample.


The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.


Regards,

Prathap S


Attachment: BlazorApp2_61dd43d4.zip


JU Justin October 20, 2022 02:20 AM UTC

Hello Prathap, 

Thank you for the response and for sending the sample project.  I implemented some changes from my project into your sample project and have been able to replicate the issue in this sample project.  I believe the issue is tied to the virtualization functionality.  

Please take a look at the attached project.  I updated the project to generate new data on each button click.  You will see initially when clicking the button, new data will be added that is sorted properly by the "order date" (descending by default based on how I setup the grid).  Please continue clicking the button around 25-30 times or so.  Eventually, you will notice the grid will stop updating properly.  

If you remove the virtualization functionality from the grid, you will see the grid will update properly. 

Please let me know if you have any questions.

Thanks, 

Justin K




Attachment: BlazorApp2_JK_fccb3547.zip


PS Prathap Senthil Syncfusion Team October 20, 2022 03:59 PM UTC

Hi Justin,


Thanks for the update.


We are validating you given the modified sample and the reported issue has been replicated on our end. Further details will be updated on or before 22 Oct 2022.


Until then we appreciate your patience.

Regards,

Prathap S



PS Prathap Senthil Syncfusion Team October 21, 2022 01:49 PM UTC

Hi Justin,


Sorry for the inconvenience caused.


Currently, we are validating your sample with high priority. Further details will be updated on or before 27 Oct 2022.


Regards,

Prathap S




PS Prathap Senthil Syncfusion Team October 26, 2022 04:21 PM UTC

Hi Justin,


Sorry for the inconvenience delayed


We have checked your query and we would like to inform that refresh the grid by using the grid refresh method or you directly assign the data source properties for refresh when a new stream is received .please refer to the below sample solution and code for your reference.


<SfGrid DataSource="@GridData" @ref="Grid" TValue="OrdersDetailsObserveData" AllowSorting="true" EnableVirtualization="true" EnableColumnVirtualization="true" EnableHover="false" Height="800" Width="auto">

@code{
public
async void AddRangeItems()

    {

 

        var j = getOrders();

        GridData.AddRange(j);

        y += 5;

        await Grid.Refresh();

    }

}

Reference Link:https://blazor.syncfusion.com/documentation/datagrid/how-to/effectively-add-range-of-items-to-observable-collection

kindly get back to us if you need further assistance.

Regards,
Prathap S


Attachment: BlazorApp2_63815cb7.zip

Marked as answer

JU Justin November 14, 2022 12:49 PM UTC

Thank you Prathap!

Justin



SG Suganya Gopinath Syncfusion Team November 15, 2022 12:47 PM UTC

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.



Loader.
Live Chat Icon For mobile
Up arrow icon