This question is locked. New answers and comments are not allowed.
My objective is to use the .LoadSettings method to create columns as well as have a Select command. I am new enough to Telerik's MVC controls to expect that I have just missed something. I have also looked through a bunch of forum posts and just can't find a good answer.
So here is my proposed Razor Grid definition in the view:
@{Html.Telerik().Grid(Model)
.Name("AccountReviewGrid")
.DataKeys( keys => keys.Add( model => model.WorkflowID ) )
.DataBinding( db => db.Ajax()
.Select("Details","AccountReviewController") )
.Columns(columns => columns
.LoadSettings((IEnumerable<GridColumnSettings>)ViewData["Columns"]))
.Columns(columns => columns.Command(commands => { commands.Select(); }))
.Pageable()
.Sortable()
.Scrollable( s => s.Height(400) )
.Resizable( r => r.Columns(true) )
.Reorderable( reorder => reorder.Columns(true) )
.Filterable( )
.ClientEvents( events => events
.OnColumnResize("onResize")
.OnColumnReorder("onReorder")
)
.Render();
}
The 2nd .Columns is ignored ( seems reasonable ).
I would hate to loose the functionality that I have by building my column settings in the controller ( i am specifying size and order ). Any thoughts on how to accomplish this?
EDIT --
So I have discovered the ClientTemplate property on GridColumnSettings but apparently this won't work with server side binding. It also appears there is no Template property on GridColumnSettings. I feel like I am close to a solution but still it evades me.
So here is my proposed Razor Grid definition in the view:
@{Html.Telerik().Grid(Model)
.Name("AccountReviewGrid")
.DataKeys( keys => keys.Add( model => model.WorkflowID ) )
.DataBinding( db => db.Ajax()
.Select("Details","AccountReviewController") )
.Columns(columns => columns
.LoadSettings((IEnumerable<GridColumnSettings>)ViewData["Columns"]))
.Columns(columns => columns.Command(commands => { commands.Select(); }))
.Pageable()
.Sortable()
.Scrollable( s => s.Height(400) )
.Resizable( r => r.Columns(true) )
.Reorderable( reorder => reorder.Columns(true) )
.Filterable( )
.ClientEvents( events => events
.OnColumnResize("onResize")
.OnColumnReorder("onReorder")
)
.Render();
}
The 2nd .Columns is ignored ( seems reasonable ).
I would hate to loose the functionality that I have by building my column settings in the controller ( i am specifying size and order ). Any thoughts on how to accomplish this?
EDIT --
So I have discovered the ClientTemplate property on GridColumnSettings but apparently this won't work with server side binding. It also appears there is no Template property on GridColumnSettings. I feel like I am close to a solution but still it evades me.