This is a migrated thread and some comments may be shown as answers.

After Data item change, filter does not operate

3 Answers 304 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Porsha
Top achievements
Rank 1
Porsha asked on 25 Jun 2020, 03:33 PM

Hi,

 

I've updated several items within two of the column fields in my kendo grid.  Of course, the data is pulled from a DB via a stored procedure in Entity Framework.

I am using the multi - true and search - true attributes for the filterable option in my grid.  The new values are there; however, when I select a value, it does not filter.  If I use just filterable: true without the multi feature, it does in fact filter.

I've tried to to reset using the setDataSource method and numerous other methods.  Is there a way to reset or perhaps clear the old values.

Thank you

3 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 29 Jun 2020, 11:59 AM

Hi Porsha,

Are you using server filtering? If you do, could you please make sure that the correct value is submitted with the filter request?

Furthermore, could you share your configuration with us? Or even better a small sample where the issue replicates?

Regards,
Georgi
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Porsha
Top achievements
Rank 1
answered on 29 Jun 2020, 01:41 PM

I am not using server filtering.  

 

Here is the implication of it.

https://dph1.adph.state.al.us/alchronicresources (production environment)

If you try filtering via FacilityType and/or ProgramType, no results are returned.

So I was able to create a fix for it in my test environment, but not sure how accurate it is because it does not persist the filter selection after I hit the Filter button.  However, it does filter and return results, but the users is unable to see what selection was made..

 

Here is the current code where the filtering semi works..

$("#grid2").kendoGrid({
                //rowTemplate: $("#rowTemplate").html(),
                //altRowTemplate: $("#altRowTemplate").html(),
                filter: 
                    function (e) {
                        if (e.filter != null) {      
                            e.filter.filters.forEach(function (f) {
                            f.operator = "contains";
                        });                      
                           
                          }                    
                  },
                selectable: true,
                change: onChange,
                dataSource:
                {
                    ds
                },

                filterable:
                {
                    multi: true,
                    search: true
                },

                columns: [
                    {
                        field: "FacilityName",
                        title: "Facility Name"
                    },
                    {
                        field: "Address",
                        title: "Address"

                    }, {
                        field: "City",
                        title: "City"
                    }, {
                        field: "County",
                        title: "County"
                    },
                    {
                        field: "District",
                        title: "District"
                    },
                    {
                        field: "Zip",
                        title: "Zip Code"
                    }, {
                        field: "PhoneNumber",
                        title: "Phone Number"
                    }
                    , {
                        field: "FacilityTypeName",
                        title: "Facility Type"
                    }
                    , {
                        field: "ProgramTypename",
                        title: "Program Type"
                    }
                    //, {
                    //    field: "GroupType",
                    //    title: "Group Type"
                    //}
                ],


                scrollable:
                    true
                //{
                //    virtual: true
                //}
                ,
                height: 500,
                sortable: true,
                pageable: {
                    pageSize: 5,
                    pageSizes: true
                },
                groupable: true,
                editable: false,
                columnMenu: true,

                excel: {
                    fileName: "ALChronicResources.xlsx",
                    filterable: true,
                    allPages: true
                },

                columnMenuInit: function (e) {
                    var multiCheck = this.thead.find("[data-field=" + e.field + "]").data("kendoColumnMenu").filterMenu.checkBoxAll;
                    if (multiCheck) {
                        var filterMultiCheck = this.thead.find("[data-field=" + e.field + "]").data("kendoColumnMenu").filterMenu
                        filterMultiCheck.container.empty();
                        filterMultiCheck.checkSource.sort({ field: e.field, dir: "asc" });
                        filterMultiCheck.checkSource.data(filterMultiCheck.checkSource.view().toJSON());
                        filterMultiCheck.createCheckBoxes();
                    }
                },

                pdf:
                {
                    fileName: "ALChronicResources.pdf",
                    allPages: true,
                    avoidLinks: false,
                    landscape: true,
                    margin: { top: "2cm", left: "1cm", right: "1cm", bottom: "1cm" },
                    paperSize: "A4",
                    repeatHeaders: true,
                    scale: 0.3,
                    template: $("#page-template").html(),
                    title: "AL Public Health Chronic Disease Support and Resources"
                }
                //persistSelection: true

            });                          

0
Georgi
Telerik team
answered on 01 Jul 2020, 11:13 AM

Hi Porsha,

Thank you for the provided url to your production app, unfortunately I am not able to open it, I assume that the app is not public.

Nevertheless, I tried to replicate the behavior using similar configuration to the provided. However, it seems to work correctly even with newly created items. You can find the sample I used for testing in the link below:

Could you please examine it and let me know what I am missing?

Regards,
Georgi
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Arvind
Top achievements
Rank 1
commented on 30 Jan 2024, 01:22 PM

Hii,

when we filter the data and after that delete data or update data the then filter should not be removed in kendo grid.

 Is there a way to.

 

Thank you

Nikolay
Telerik team
commented on 01 Feb 2024, 12:45 PM

Hi Arvind,

The applied filter is not cleared once an item from the Grid is deleted or edited. Please refer to the below screencast I recorded:

https://app.screencast.com/un0CM7ZFEjzG5

The Dojo I used: https://dojo.telerik.com/IkuTogAy

Could you please modify the above to showcase the problem so I can advise further?

Regards,

Nikolay

Tags
Grid
Asked by
Porsha
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Porsha
Top achievements
Rank 1
Share this question
or