[Data Grid Reactive] To add row requires no filter or sort - how to force grid to clear before adding?
Forge component by Bruno Martinho
Application Type
Reactive

Hi,

I am implementing the Add Row feature, but the Grid must not have any sort or order applied, otherwise I get the error.

Error when column sorted:


Error when column with filter:

I was able to implement a JS code to clear the Filter:

GridAPI.GridManager.GetGridById($parameters.GridId).features.filter._filter.clear()


But I was unable to find a function to clear the sorting, so the user won't have to clear any column sorting. 

Is there a function to easily clear all sorting applied to the grid? 

Thanks.

Hello @Joao Kuae,

Thanks for bringing this subject to the discussion. 

It seems that you want to clear the sorting from all columns. After some searching I found that you can remove it by executing the following line:

GridAPI.GridManager.GetGridById($parameters.GridId).provider.itemsSource.sortDescriptions.clear()


Hope this helps,

Best Regards,

Tiago Pereira

Hello @Joao Kuae ,

Can you please let us know if you are using the Custom Menu item to implement the Add new Row?

Would it be helpful to have these actions as a public client action?

Thank you @Tiago Miguel Pereira! It worked!


@Bruno Martinho,

Yes, I am using the Custom Menu Item to implement it.

I think it would be great to have those actions as public - it gives more flexibility for developers.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.