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

manual filtering via custom dataadaptor does not remove the obsolete items.

I’m using a data grid, with datamanager and a custom Dataadaptor.

I’ve only implemented the readAsync method on the Dataadaptor.

It works fine - and as my dataset is very large, I use virtualization. Normally about 60 items are requested.

The filter I apply in the ReadAsync method, from another source (another control ln the page).

I return the DataResult, with count set to the number of items under the current filter, and the items in the Result Property.

I trigger a refresh on the data grid with Grid.Refresh().

When a filter setting produces less the the requested items (say 10), the items requested show, but below them, the previous unfiltered items are also shown. Only on a second refresh, does it seem to take into account the now smaller item count, and only the 10 items are shown.



3 Replies

VN Vignesh Natarajan Syncfusion Team October 26, 2022 04:04 AM

Hi Vincent,


Thanks for contacting Syncfusion support.


Query: “Only on a second refresh, does it seem to take into account the now smaller item count, and only the 10 items are shown.”


From your query, we understand that you are facing an issue while performing the external filter action. But we need some more details to validate the issue further at our end. So kindly share the following information to validate the reported issue further at our end.


  1. Share the details, of how you have applied the filtering to the Grid component.
  2. Are you using the FilterByColumnAsync method or Query property of Grid?
  3. If possible share a simple issue reproducible sample.
  4. Also,      share details about the Refresh method being called from which action.


The above-requested details will be very helpful in validating the reported issue at our end and providing a solution as early as possible.


Regards,

Vignesh Natarajan



VI Vincent October 28, 2022 04:44 AM

Dear Vignesh, Thank you for your reply.


  1. I have not applied any filtering to the datagrid. The filtering I apply in the read method, based on settings external to the syncfusion control (A slider on the same page).
  2. Neither - there is no filter set - see 1. Apologies for the confusion
  3. I will do so, if
  4. See below. The returned Count property on the Dataresult does not seem to be taken into account on the first return.

The Read method on the data adapter:
public override async Task<object> ReadAsync(DataManagerRequest dm, string? key = null)
{
var transactions = (await TransactionsService.GetTransactionsLocalOrServerAsync(dm.Skip, dm.Take, _mbsUnderFilter)).ToList();


IEnumerable? transactionRows = TransactionRowModelsInCurrentFilterAsync(transactions);
if (transactions.Count() < dm.Take)
{
Console.WriteLine("Not all transactions returned");
}

DataResult dataResult = new()
{
Count = TransactionsInFilterCount,
Result = transactionRows,
//FilteredRecords = transactionRows,
};
return dataResult;
}

The method that is called on the grid component (Refresh).

private async void Filter_SelectedValueChanged(object? sender, ICashTransactionFilter e)
{
Console.WriteLine("Page: Filter has Changed");
if (Grid != null)
{
TransactionDatagridAdaptorComponent?.UpdateMbsUnderFilter(e); //this method does not impact the grid, but prepares some data for a future read request
await Grid.Refresh(); //this triggers the read request, and needs to be applied twice to incorporate the change in DataResult.Count
}
}


KG Keerthana Ganesan Syncfusion Team October 31, 2022 10:41 PM

Hi Vincent,

Welcome from Syncfusion support.

Currently, we are validating your query at our end. Further details will be updated on or before 3rd November 2022.


Until then we appreciate your patience.

Regards,

Keerthana.


Loader.
Live Chat Icon For mobile
Up arrow icon