Declined
Last Updated: 20 Jan 2022 12:12 by ADMIN
Fred
Created on: 28 Jul 2017 20:37
Category: Grid
Type: Feature Request
1
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.
0 comments