dynamic custom commands

2 posts, 0 answers
  1. Shaun
    Shaun avatar
    10 posts
    Member since:
    Dec 2010

    Posted 22 Aug 2013 Link to this post

    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 ?

  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 26 Aug 2013 Link to this post

    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
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top