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

Grid filter row weird behaviour

3 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Frederike
Top achievements
Rank 1
Frederike asked on 22 Jul 2014, 08:36 AM
I'm trying to add the new filter row to my grids. I'm using the MVC wrappers and ajax data sources.
The filter row displays fine. However, when I enter a value in one of the filters, all the other filters in the row also get this value (see screen snippet), and no filtering actually happens (no data source request).

In the page source I can see that all filter inputs have a MVVM value data binding to the same property. This may explain why they all get the same value when one of them changes, although this does not seem to be a problem in the online demo's.
My application is a single page application and I use MVVM on most pages. The grids are not in the scope of an MVVM binding though.

Does somebody have an idea in which direction I should be looking for a solution?

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 24 Jul 2014, 06:31 AM
Hi Edi,

I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide a runnable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior and advise you further.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Frederike
Top achievements
Rank 1
answered on 29 Jul 2014, 02:30 PM
Hi Alexander,

I have attached a simple project that reproduces the problem.
0
Alexander Popov
Telerik team
answered on 31 Jul 2014, 09:41 AM
Hello again Edi,

Thank you for the provided project. I reviewed it and noticed that the Grid is initialized using the wrappers, however it is displayed using a Kendo UI View. In the current scenario, the Grid is first rendered, then the MVVM binds it, then the View's MVVM overrides the Grid bindings, thus causing the unexpected behavior of the row filters. If you prefer using the MVVM approach I would suggest sticking to it entirely, as mixing different approaches might have unpredictable results as this one. The workaround for this exact scenario is to use deferred execution, so the Grid's MVVM bindings are executed after the View has finished loading. For example:  
<div class="ng-view">
    @(Html.Kendo().Grid<EmployeeListItemViewModel>()
            .Name("grid")
            .Deferred()
            ....
        )
</div>
 
<script>
    //use a timeout to let the View's MVVM finish before initializing the Grid
    setTimeout(function(){
         @(Html.Kendo().DeferredScripts(false)) //render the Grid's initialization options here
    })
 
</script>


Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Frederike
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Frederike
Top achievements
Rank 1
Share this question
or