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

[Solved] Problem with paging on ajax databinding

1 Answer 79 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.
Sid
Top achievements
Rank 1
Sid asked on 26 Apr 2012, 04:33 PM
I have a grid with the following configuration:
@(Html.Telerik().Grid(Model)
.Name("grdMyApprovals")
.DataKeys(keys => keys.Add(j => j.journey_id))
.DataBinding(dataBinding => dataBinding
    .Ajax()
        .OperationMode(GridOperationMode.Client)
        .Select("Index", "Dashboard"))
 
.ClientEvents(events => events
        .OnRowSelect("onPanelSelect"))
.Columns(columns =>
             {
                 columns.Bound(j => j.journey_desc)
                     .Title("Description");
                 columns.Template(j => j.TotalTasks)
                     .Title("Total");
                 columns.Template(j => j.RemTasks)
                     .Title("Done");
                 columns.Bound(j => j.create_date)
                     .Title("Created")
                     .Format("{0:d}");
             })
             .Selectable()
             .Pageable(page=>page.PageSize(5))
)

See grid1 attachment.

When I page, it loses the two calculated fields from the stored procedure.  See grid2 attachment.  Am I missing something obvious?
I just noticed i had it bound to a List type:
@model List<DZModel.OriginatorApprovalViewModel>

 

Is there something about List vs. IEnumerable causing a problem?  Is it a caching issue?
Any help would be greatly appreciated!
Thanks,
-Sid.

 


1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 30 Apr 2012, 11:03 AM
Hi Sid,

You are using the Template method ( columns.Template(j => j.RemTasks) ) which is used is server binding (or initial loading) - once you perform Sorting/Paging/Filtering - your Template wont be displayed.
You should use the Bound method or the ClientTemplate with client expression e.g.
columns.ClientTemplate(" <#= RemTasks #> ") 


All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Grid
Asked by
Sid
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or