New client details template

11 posts, 2 answers
  1. Victor
    Victor avatar
    167 posts
    Member since:
    Nov 2010

    Posted 07 Jul 2012 Link to this post

    Hi!

    We are trying out the new client details template (ClientDetailTemplateId). We can get a basic hierarchy grid working, but have some problems:
    • We cannot get column client templates in the sub-grid to work ("[columnName] is not defined" js error)
    • We  cannot get a two level hierarchy going ("b is not defined")

    Are any of these two scenarios supposed to work at the moment, and if so, is there any demo code available?


    On a related note: We always bind our grids server-side first and do following operations (sort/filter/etc) using client code. Are there any plans on making it possible to define a template once and get it working in both scenarios? For us we really only use server binding once and would prefer is details are loaded via ajax on demand, but using a client details template only gives an empty details view as far as we know...

    Thank you
    /Victor

  2. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 10 Jul 2012 Link to this post

    Hello Victor,

    For your convenience I am attaching sample app demonstrating two levels of hierarchy and client template for the column. We are unable to replicate the errors described in your posts, so could you try replicate them on the sample project for us?

    If ajax data source is defined the Grid will be created on client and only client templates will be rendered.

    Regards,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Victor
    Victor avatar
    167 posts
    Member since:
    Nov 2010

    Posted 11 Jul 2012 Link to this post

    Hi Nikolay!

    Many thanks for the working code. Building from that, it still took some time to track down the problem, but I finally managed to produce a small example illustrating the problem.

    Basically you in the details grid have access to the parent grid's variables. However, as those coincided in the original example it was very hard to see the problem.

    Edit: After thinking a bit more about this, it is probably very helpful to have access to the parent row's values as well, such as:
    ...ClientTemplate("#=tParentRow.Category# -> #=Name#");
     

    Cheers
    /Victor
  4. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 12 Jul 2012 Link to this post

    Hello Victor,

    I see what you mean now. In order to have reference to the parent data item inside the column template #=field# expression should be used, but in order to use expression for the current data item you should escape the binding expression, i.e \\#=field\\#.

    For more details please refer to the attached project.

    Regards,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Victor
    Victor avatar
    167 posts
    Member since:
    Nov 2010

    Posted 12 Jul 2012 Link to this post

    Hi and thank you!

    Works well when you know how to do it (even though it's a bit counter-intuitive that templates should be configured differently than "parent" grids to get the same behaviour). Hopefully this will be (is?) well documented when the final documentation is out for Kendo UI MVC wrappers!

    Thanks again
    /Victor
  6. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 13 Jul 2012 Link to this post

    Hello Victor,

    This isn't yet in the docs, but surely it will be included.

    All the best,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Majid
    Majid avatar
    7 posts
    Member since:
    Sep 2012

    Posted 26 Nov 2012 Link to this post

    Hi Nikolay,

    If a child grid's column name is referenced as "//#=childColumnName//#" in the client template, then how can I use such a column in an if statement in my client template script?

    I know that for the parent grid, I can use the following syntax:

    "# if(parentColumnName == someValue) {# do something; #}#"

    But I cannot figure out what syntax I should use to reference child grid's column name in an if statement.

    Thank you,
    Majid
  8. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 29 Nov 2012 Link to this post

    Hello Majid,

    You should use the same approach to escape the `#` symbol. See the attached sample.

    Regards,
    Nikolay Rusev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  9. Majid
    Majid avatar
    7 posts
    Member since:
    Sep 2012

    Posted 29 Nov 2012 Link to this post

    Thank you very much Nikolay.

    I got it!

    Majid
  10. jose
    jose avatar
    8 posts
    Member since:
    Apr 2012

    Posted 24 Dec 2012 Link to this post

    Everytime i find a crazy good example Nikolay Rusev is on the post. Good job!
  11. Rob
    Rob avatar
    12 posts
    Member since:
    Mar 2013

    Posted 02 May 2013 Link to this post

    This was super helpful and extremely hard to find documentation on. If possible, maybe include an example in either the documentation or in one of the Kendo Grid demos. Thanks for the solution, though!
Back to Top