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

[Solved] Fiterable Grid Doesn't Filter

2 Answers 169 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.
M
Top achievements
Rank 1
M asked on 21 Apr 2010, 09:51 PM
I just started using the telerik MVC controls (extensions) today and am pleased how fast I was up and running.

One small issue that I am having however is my grid does not filter. Here are some quick code snippets of how I am setup:
VIEW
<% Html.Telerik().Grid(Model) 
        .Name("Grid") 
        .ToolBar(commands => 
        { 
            if (Html.IsAuthenticated()) 
            { 
                commands.Custom().Text("Add Record").Action("Create", "Asset"); 
            } 
        }) 
        .DataKeys(keys => keys.Add(asset => asset.Id)) 
        .DataBinding(dataBinding => dataBinding.Server()) 
        .Columns(columns => 
        { 
            if (Html.IsAuthenticated()) 
            { 
                columns.Template(asset => 
                {%> 
                    <href="<%= Url.Action("Edit", "Asset", new {id = asset.Id}) %>">Edit</a> 
                <%}); 
            } 
            columns.Bound(a => a.AnotherProperty); 
            /* remaining fields omitted */ 
        }) 
        .Sortable() 
        .Pageable() 
        .Filterable() 
        .Render(); 
    %> 

in Site.Master I have:
<% Html.Telerik().ScriptRegistrar() 
                     .DefaultGroup(group => group 
                         .Add("telerik.examples.js") 
                         .Compress(true) 
                         .UseTelerikContentDeliveryNetwork(true)) 
                     .OnDocumentReady(() =>{ %>prettyPrint();<% }).Render(); %> 

basically, the filter images show up, but are not clickable. I did notice the following javascript error on the page:

Message: 'fx' is null or not an object
Line: 3
Char: 5
Code: 0
URI: http://aspnet-scripts.telerikstatic.com/mvcz/2010.1.309/telerik.examples.min.js

so i did some googlin and came across this thread which said to put
<%= Html.Telerik().ScriptRegistrar() %>
on each page, but when I add that to my view, I get a "You cannot call render more than once" error

I have a feeling I am close to the correct solution, but I've exhausted my own intellectual prowess at this point.






2 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Top achievements
Rank 1
answered on 22 Apr 2010, 08:28 AM
Hi,

I believe that telerik.examples.js file is not needed and you should not register it :). As I know it is part of the QSF of the components and it is not part of the components themselves. I will suggest you to examine the help articles in their online help.

Regards,
Peter
0
M
Top achievements
Rank 1
answered on 22 Apr 2010, 02:56 PM
Thank you Peter!

I changed the Script Registrar to
<%= Html.Telerik().ScriptRegistrar() 
        .DefaultGroup(group => group 
            .Compress(true) 
            .UseTelerikContentDeliveryNetwork(true))%> 

and moved it to the bottom of site master, and that solved my problem.
Tags
Grid
Asked by
M
Top achievements
Rank 1
Answers by
Peter
Top achievements
Rank 1
M
Top achievements
Rank 1
Share this question
or