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

RowTemplate and columns?

1 Answer 330 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ken De Vries
Top achievements
Rank 1
Ken De Vries asked on 21 Oct 2015, 08:47 PM

Hi,

 I am trying to create a grid with one column to return a result similar to your example here: http://demos.telerik.com/kendo-ui/grid/rowtemplate.  I am using the server-side RowTemplate code such as...

            @(Html.Kendo().Grid(Model.Results)
                .Name("Components")
                .RowTemplate(grid =>
                    @<text>
                    <tr>
                        <td>
                            ID: @item.ComponentID<br>

                            Name: @item.Name

                            ... etc
                        </td>
                    </tr>
                    </text>
                )

            .DataSource(d => d.Ajax().ServerOperation(false))
            .Pageable(pageable => pageable
                .Refresh(true)
                .PageSizes(true)
                .ButtonCount(5))
            )

 I am basing my code on this example:

@model IEnumerable<Product>@(Html.Kendo().Grid(Model).Name("grid")

    .RowTemplate(grid => @<text><div>Product Name: @product.ProductName</div><div>Units In Stock: @product.UnitsInStock</div></text>))

​The output completely ignores the rowFormat and prints every field in the model object as a separate column (see attached photo).

I have tried almost everything - client templates, etc.  Nothing stops every column from being displayed.

 Any ideas would be appreciated.

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 22 Oct 2015, 11:44 AM

Hello Ken,

The current Grid uses an Ajax DataSource, meaning that a client row template should be used instead. You could find the MVC equivalent of the demo here.

Regards,
Dimiter Madjarov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Ken De Vries
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or