r3d
r3d

Reputation: 85

Telerik Grid Master / Detail - display expand only if detail data exists

I have to display data using the telerik grid (master / detail) .

Is there a possibility to show the expand icon only if data exists for the master record? And how can i get this done?

Thanks in advance

Upvotes: 2

Views: 1884

Answers (1)

Yves Tremblay
Yves Tremblay

Reputation: 56

On client-side:

<script>
    function hidePlusSign(e) {
        var row = e.row;
        var dataItem = e.dataItem;

        if (!dataItem.Expression) {
            $('a.t-icon', e.row.cells).css('display', 'none');
        }
    }
</script>
...
.DetailView(d => d.ClientTemplate("<# if (expression) { #>" +
                                       Html.Telerik().Grid<Details>...ToHtmlString()
                                   + "<# } #>")
.ClientEvents(e => e.OnRowDataBound("hidePlusSign"))
...
  • replace "Expression" with your condition.

On server-side:

I think you get the idea. The template is easier and for hiding the plus sign use the RowAction.

Upvotes: 4

Related Questions