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

Conditional Template Display

2 Answers 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 2
Veteran
Iron
Grant asked on 17 Nov 2016, 09:39 AM

Hi, 

I'd like to use the Grid's detailTemplate, but is it possible to only render it based on a condition?

Example: http://dojo.telerik.com/uyIja

This is a basic example, that only displays the template contents if the 'male' field is true. But is it possible to prevent the details template drop down arrow from being displayed, I mean its useless displaying a way to view a details template if its empty.

Thanks,
Grant

2 Answers, 1 is accepted

Sort by
0
Accepted
Stephen
Top achievements
Rank 2
answered on 17 Nov 2016, 02:29 PM

The problem is that the detailTemplate is not actual rendered(present in the DOM) until you expand it, so the grid renders the expand arrow based simply on the fact that a detailTemplate is defined in the grid options...it has no idea that the content of the template is blank until after it is expanded.

 

You can try removing the expand icon in the dataBound event and see how that works for you.

http://dojo.telerik.com/@Stephen/iHAXe

 

 

0
Grant
Top achievements
Rank 2
Veteran
Iron
answered on 17 Nov 2016, 02:35 PM
Thanks, this is a great work around none the less
Tags
Grid
Asked by
Grant
Top achievements
Rank 2
Veteran
Iron
Answers by
Stephen
Top achievements
Rank 2
Grant
Top achievements
Rank 2
Veteran
Iron
Share this question
or