I suggest you ...

pass server side variables into client footer template funcitons

Currently, there's no way to pass variables into client footer template functions that are registered with client footer templates.

In the case when you have multiple grids on the same page with different grid ids, you are forced to instantiate multiple javascript callback functions with the grid id/name baked into the function.

Consider:

@foreach @foreach (var model in Model.MyModels)
...
...
@(Html.Kendo().Grid<eFHOL.Models.ViewModels.MyModelModel>
()
.Name("ModelGrid_" + @model.ID)
.Columns(columns =>
{
columns.Bound(m => m.Name).Width(30).ClientFooterTemplate("#= footerLabel(data) #");
columns.Bound(m => m.Hours).Width(30).ClientFooterTemplate("#= HoursSumAvg_" + @model.ID + "(data) #");
columns.Bound(m => m.Weight).Width(30).ClientFooterTemplate("#= WeightSumAvg_" + @model.Weight + "(data) #");

And you will have to have server side code to register and wire up each of these distinct javascript footer template callback functions:

@foreach(var modelID in Model.ModelIDs)
{
var hourFunction = "function HoursSumAvg_" + modelID + "(model) ";

<text>
@hourFunction
{
var grid_name = '#FlowPlanDetailsGrid_@modelID';
return HoursSumAvg(grid_name);
}

This quickly becomes a mess if you have a for loop that renders 5 or 10 grids, as we have the use-case for.

It would be very helpful if there was a way to register the name of the callback which accepts server side parameters that can be evaluated on the server side and passed to the javascript function.

Alternatively, if the client footer template functions could somehow retain the name of the grid they are bound to, via a property in the parameter passed in, that would be good enough.

1 vote
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Fred WangFred Wang shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base