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

dynamic custom commands

1 Answer 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shaun
Top achievements
Rank 1
Shaun asked on 22 Aug 2013, 09:46 AM
I have a grid with another grid inside the client detail.  Each grid gets it data using ajax calls.

 In the second grid I need to display various buttons against each row based on a value in a status field (let's call that StatusID)
The number of buttons varies from none to 5.  I was thinking to put them all inside 1 column.
How can I achieve this ? 

I am using the fluent grid declaration

After playing with it for a while I noticed this :

In my second grid ( aka the grid inside  the ClientDetailTemplateID, i cannot use the bound values whatever I do

My column looks like this :

columns.Bound(p => p.PublishStatusID).ClientTemplate("#= PublishStatusID #");
As you can see this is just a test to get the value to display before I move on to building a button. I am getting an error  telling me that PublishStatusID  does not exist. In fact none of the bound properties can be accessed at all except for the one which is basically the key passed by the parent grid.
The data in the grid itself displays fine, but I cannot access it whatever I do in a ClientTemplate

The controller is setup to return data for the grid : 
public JsonResult GetSomeData([DataSourceRequest] DataSourceRequest request, int someID)
 and it returns this.Json(model.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);

What's going on ?





1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 26 Aug 2013, 08:00 AM
Hello Stuart,

Since the Grid is positioned inside the detail template expressions inside the client template inside of the inner Grid will be evaluated by the outer, to avoid this you need to escape the sharp symbols.


Regarding the first question you can use the template to execute conditional logic and render different buttons based on your data. Check the FAQ for similar question.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Shaun
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or