Applied Filter not displaying data after refreshing the data by a service call

0 Answers 63 Views
GridView
Premkumar
Top achievements
Rank 1
Iron
Iron
Premkumar asked on 10 Oct 2023, 01:34 PM

Hi Telerik Team,
In my RadGridView I have 100 items, I'm applying filters for 2 columns.
The data is filtered and shows 2 items now.

I'm editing some columns (which are not filtered columns) and saving it.

After save, I'm calling the service to retrieve the 100 items (it means I'm refreshing the data).

The data is retrieved, but the RadGridView displays empty as the applied filter not works correctly.

It should display the same 2 records.

If I try clearing any one filter, it displays records based on 1 applied filter.

Please provide a fix for this. I want the filter to be applied after refreshing also.

Awaiting for your reply.

Thanks and Regards,
Muhammad Azhar Shah

Dimitar
Telerik team
commented on 11 Oct 2023, 05:32 AM

Hi Premkumar, 

Can you provide more information about the service and the approach you are using to bind the grid? Perhaps share the code that you are currently using. 

Thank you in advance for your patience and cooperation. 

Regards

Dimitar

 

Premkumar
Top achievements
Rank 1
Iron
Iron
commented on 11 Oct 2023, 09:32 AM

Hi Dimitar,
Thank you for your reply.

I'll share some code for your better understanding; however, I cannot share the complete code.

XAML:

<telerik:RadGridView
        x:Name="myRadGridView"
        AutoGenerateColumns="False"
        CanUserReorderColumns="True"
        CanUserSortColumns="True"
        GridLinesVisibility="Horizontal"
        IsFilteringAllowed="True"
        IsReadOnly="True"
        IsSynchronizedWithCurrentItem="True"
        ItemsSource="{Binding DataList}"
        KeyboardNavigation.TabNavigation="Cycle"
        RowIndicatorVisibility="Collapsed"
        ShowGroupPanel="False"
        ShowToolTipOnTrimmedText="True">
        <telerik:RadGridView.Columns>
...
</telerik:RadGridView.Columns>
</telerik:RadGridView>

 

C#:

private async Task LoadData()
{
    this.IsBusyIndicator = true;
    this.DataList = await this.uiService.GetData(); ////This will fetch 100 items.
    this.IsBusyIndicator = false;
}

private async Task SaveData(object arg)
{
this.IsBusyIndicator = true;
var operationOutcome = await this.uiService.SaveData(arg);
        if (operationOutcome.Status.Equals(OperationOutcomeStatus.Success))
        {
            await this.LoadData();
        }

this.IsBusyIndicator = false;
}

 

I have applied filters for 2 columns before I editing and saving the data.
In my Save method, I'm calling the LoadData() method after successful saving in DB.
The LoadData() method returns 100 items.
But already I have applied 2 filters right.

So, from the 100 items the filter should apply in client side and should display only 2 records.

But it is not happening, instead it displays empty. When I clear any one filter, I could see the data with 1 filter applied.
This is the scenario.
Please provide a fix on this.
Awaiting for your reply.

Thanks and Regards,
Muhammad Azhar Shah

Dimitar
Telerik team
commented on 12 Oct 2023, 10:59 AM

Hi Premkumar, 

Your approach seems ok to me. I have tested it and it works on my side. I have attached my test proejct. Could you please check it na let meknow if I am missing something? 

Thank you in advance for your patience and cooperation. I am looking forward to your reply.

Premkumar
Top achievements
Rank 1
Iron
Iron
commented on 17 Oct 2023, 06:48 AM

Hi Dimitar,
Thank you for your reply.

May be your sample solution is very simple.
Could you please try by having a ComboBox in CellTemplate and for the GridViewDataColumn set the DataMemberBinding="{Binding SelectedStatus.Name}".
Because we are having our gridview like this.
And please try filtering in that column and reload the data again.

<telerik:GridViewDataColumn
                                Width="120"
                                MinWidth="65"
                                MaxWidth="200"
                                DataMemberBinding="{Binding SelectedStatus.Name}"
                                Header="Status"
                                HeaderCellStyle="{StaticResource RadColumnWithBorder}"
                                HeaderTextTrimming="CharacterEllipsis"
                                HeaderTextWrapping="WrapWithOverflow">
                                <telerik:GridViewDataColumn.CellTemplate>
                                    <DataTemplate>
                                        <telerik:RadComboBox
                                            DisplayMemberPath="Name"
                                            FontSize="12"
                                            ItemsSource="{Binding Statuses}"
                                            SelectedItem="{Binding SelectedStatus, Mode=TwoWay}" />
                                    </DataTemplate>
                                </telerik:GridViewDataColumn.CellTemplate>
                            </telerik:GridViewDataColumn>
Dimitar
Telerik team
commented on 18 Oct 2023, 01:09 PM

Hi Muhammad, 

I have tested with this but I am getting the same results. In addition, the column type and editors do not affect the filtering which is performed directly on the data. This seems to be a very specific case. I would recommend posting a new ticket (which is a private thread) about it and attaching your project or a sample project that reproduces this. This will allow us to properly investigate the case and determine what is causing this. 

Thank you in advance for your patience and cooperation. 

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Premkumar
Top achievements
Rank 1
Iron
Iron
Share this question
or