Conditional Template Display

2 posts, 1 answers
  1. Grant
    Grant avatar
    114 posts
    Member since:
    Jul 2016

    Posted 17 Nov 2016 Link to this post

    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. Answer
    Stephen
    Stephen avatar
    90 posts
    Member since:
    Jan 2011

    Posted 17 Nov 2016 in reply to Grant Link to this post

    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

     

     

  3. Grant
    Grant avatar
    114 posts
    Member since:
    Jul 2016

    Posted 17 Nov 2016 Link to this post

    Thanks, this is a great work around none the less
Back to Top