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

New client details template

10 Answers 596 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 07 Jul 2012, 08:28 PM
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

10 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 10 Jul 2012, 07:05 AM
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!
0
Victor
Top achievements
Rank 1
answered on 11 Jul 2012, 07:31 PM
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
0
Accepted
Nikolay Rusev
Telerik team
answered on 12 Jul 2012, 09:51 AM
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!
0
Victor
Top achievements
Rank 1
answered on 12 Jul 2012, 11:31 AM
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
0
Nikolay Rusev
Telerik team
answered on 13 Jul 2012, 10:36 AM
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!
0
Majid
Top achievements
Rank 1
answered on 26 Nov 2012, 10:19 PM
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
0
Nikolay Rusev
Telerik team
answered on 29 Nov 2012, 08:02 AM
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!
0
Majid
Top achievements
Rank 1
answered on 29 Nov 2012, 12:34 PM
Thank you very much Nikolay.

I got it!

Majid
0
jose
Top achievements
Rank 1
answered on 25 Dec 2012, 12:12 AM
Everytime i find a crazy good example Nikolay Rusev is on the post. Good job!
0
Rob
Top achievements
Rank 1
answered on 03 May 2013, 04:47 AM
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!
Tags
Grid
Asked by
Victor
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Victor
Top achievements
Rank 1
Majid
Top achievements
Rank 1
jose
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Share this question
or