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

Using Server Filtering on a combo box inside a Window throws Javascript error

1 Answer 23 Views
Window
This is a migrated thread and some comments may be shown as answers.
Carrie
Top achievements
Rank 1
Carrie asked on 26 Sep 2013, 07:13 PM
Hello,

I am calling a Window that populates using a Controller Action Partial View.   My window will contain cascading dropdowns.  If I add a serverfiltering with a datafilter to my datasource I get a javascript error saying it can't find said method.   When I remove the filter the box populates but Autocomplete doesn't work properly.    If I change it to clientside filtering it works fine but I need to be able to add a group filter.     Is Server filtering not available inside a Window control ?

I prepared a sample project to illustrate the problem. 

Thanks,
Carrie

1 Answer, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 30 Sep 2013, 12:17 PM
Hello Carrie,

There is no problem at all to use server filtering combobox within a Window widget. The problem actually is that the function is still not defined since the script are executed in the order they are in the partial view.

To fix it and make it work just put the script definition above the widget.

e.g.

                
<script>
 
  
    function filterAssignByGroup() {
        alert("window here");
        return {
            userFilter: $("#AssignTaskAssignedTo").val()
        };
    }
     
</script>
 
@model KendoUIPOC.Models.User
 
           @using (Html.BeginForm())
 
            {
 
               
               @:Select a user
                
               @(Html.Kendo().ComboBoxFor(m => m.AssignTaskAssignedTo)
                          .Placeholder("Choose One")
                          .DataTextField("Text")
                          .DataValueField("Value")
                          .Filter(FilterType.Contains)
                          .AutoBind(false)
                          .SelectedIndex(0)
                          .DataSource(dataSource => dataSource
                                         .Read(read => read.Action("GetUserList", "Home")
                                           .Data("filterAssignByGroup"))
                                                        .ServerFiltering(true)
                          )
                          )
      <br/>
                
<input type="submit" id="AssignByGroupButton" value="Save" class="k-button" />
 
                
  
}

I hope this helps.

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