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

[Solved] Filtering problems: telerik.grid.filtering.min.js

4 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kenneth Jamieson
Top achievements
Rank 1
Kenneth Jamieson asked on 01 Mar 2010, 05:23 PM
Ok... new problem :)

I have a grid that works fine until I enable filtering (sorting and so on work fine) - then it has problems. Here is the code in the view...

 
<%= Html.Telerik().Grid(Model.Players)  
        .Name("Roster")  
        .Columns(columns =>   
        {  
            columns.Add(o => o.FirstName).Width(120);  
            columns.Add(o => o.LastName).Width(120);  
            columns.Add(o => o.Position).Width(50);  
            columns.Add(o => o.Height).Width(120);  
            columns.Add(o => o.Weight).Width(120);  
        })  
        .Ajax(ajax => ajax.Action("_RosterAjaxBinding", "Players"))  
        .Pageable()  
        .Sortable()  
        .Filterable()  
%> 
</asp:Content> 

The controller is as follows, where "Roster" is the initial action. The WebPlayerListView obkject has "Players" as a IEnumerable<PlayerView>.

        [GridAction]  
        public ActionResult _RosterAjaxBinding()  
        {  
            WebPlayerListView rawview = webPlayerViewFactory.CreateWebPlayerListView(0, 50000);  
 
            var gridview = new GridModel<PlayerView>();  
            gridview.Data = rawview.Players;  
 
            return View(gridview);  
        }  
 
        public ActionResult Roster()  
        {  
            WebPlayerListView theview = webPlayerViewFactory.CreateWebPlayerListView(0, 50000);  
 
            return View(theview);  
        } 

When I run the page, if I attempt to filter I get the following error in Firebug...
e(h.string()).appendTo(this.element).find(".t-datepicker").tDatePicker is not a function  
http://localhost:38574/Scripts/2010.1.218/telerik.grid.filtering.min.js  
Line 1 

Any guidance would be incredibly helpful.

Ken

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 01 Mar 2010, 05:28 PM
Hi Kenneth Jamieson,

You seem to be manually including the JavaScript files of the grid. If this is the case please include "telerik.calendar.min.js" and "telerik.datepicker.min.js" (in that order). The grid is now using the DatePicker for the filtering menu. Of course that code should have not been executed when you don't have a column bound to DateTime :) This problem will be fixed in the official release which is due this Month.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Kenneth Jamieson
Top achievements
Rank 1
answered on 01 Mar 2010, 06:07 PM
"You seem to be manually including the JavaScript files of the grid. "

Not to the best of my knowledge. I didn't include the stuff from the master page... let me do that here. The master page has this as the last three lines..

<%= Html.Telerik().ScriptRegistrar() %> 
</body> 
</html> 
 

Which expands to this in the rendered document...

<script type="text/javascript" src="/Scripts/2010.1.218/jquery-1.4.1.min.js"></script>  
<script type="text/javascript" src="/Scripts/2010.1.218/telerik.common.min.js"></script>  
<script type="text/javascript" src="/Scripts/2010.1.218/telerik.grid.min.js"></script>  
<script type="text/javascript" src="/Scripts/2010.1.218/telerik.grid.filtering.min.js"></script>  
<script type="text/javascript">  
//<![CDATA[
jQuery(document).ready(function(){
jQuery('#Roster').tGrid({columns:[{"member":"FirstName","type":"String","title":"First Name"},{"member":"LastName","type":"String","title":"Last Name"},{"member":"Position","type":"String","title":"Position"},{"member":"Height","type":"String","title":"Height"},{"member":"Weight","type":"String","title":"Weight"}], plugins:["filtering"], total:3, sortMode:'single', ajax:{"selectUrl":"/Players/_RosterAjaxBinding"}});});
//]]> 
</script>  

So what is the best syntax to add the required files with?

Thanks!


0
Kenneth Jamieson
Top achievements
Rank 1
answered on 02 Mar 2010, 12:28 AM
In the end, this solved it...

<%  
 
    Html.Telerik().ScriptRegistrar().Scripts(scripts => 
            scripts.AddGroup("CommonScript", group => group  
                    .Add("~/Scripts/2010.1.218/telerik.calendar.min.js")  
                    .Add("~/Scripts/2010.1.218/telerik.datepicker.min.js")  
                )  
            )  
        .Render();   
%> 
0
Will Yeung
Top achievements
Rank 1
answered on 04 Mar 2010, 07:39 AM
Tags
Grid
Asked by
Kenneth Jamieson
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Kenneth Jamieson
Top achievements
Rank 1
Will Yeung
Top achievements
Rank 1
Share this question
or