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

Grid RowTemplate Problems

3 Answers 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 14 Aug 2015, 04:11 PM

Hi,

I am trying to use the @Html.Kendo().Grid(Model) to generate a row template, but it doesn't do what I want... The code I have so far is:

 

@(Html.Kendo().Grid(todayFocus)
    .Name("TodaysFocus")
    .Columns(columns =>
    {
        columns.Template(c => { }).ClientTemplate(" ").Title("Today's Focus");
        columns.Template(c => { }).ClientTemplate(" ").Title("Mid Day");
        columns.Template(c => { }).ClientTemplate(" ").Title("End Dday");
        columns.Template(c => { }).ClientTemplate(" ").Title("Plan");
        columns.Template(c => { }).ClientTemplate(" ").Title("Target");
    })
      .RowTemplate(grid => @<text>
                                <td>@item.TaskName</td>
                                <td>@item.MidDay</td>
                                <td>@item.EndDay</td>
                                <td>@item.Plan</td>
                                <td>@item.Target</td>
                            </text>)
)

 And what I am getting for each row is:

<tr>
    <td colspan="5"> /<td>
    <td>Task Name</td>
    <td>10</td>
    <td>20</td>
    <td>30</td>
    <td>40</td>
</tr>

Why am I getting the extra <td colspan="5"> and how do I get rid of it?

Thanks

3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 18 Aug 2015, 08:36 AM

Hello Sam,

This is the out of the box behavior in a server bound Grid with row template. A cell with colspan according to the number of columns is rendered to wrap the template contents. If regular columns are required, you could directly use the column templates instead.

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
0
Sam
Top achievements
Rank 1
answered on 18 Aug 2015, 08:54 AM

Hi,

Thanks for the reply. Where I was trying to head was to get a table with a footer spanning 2 columns, such as:

 

<table>
    <thead>
        <tr>
            <th>Col1</th>
            <th>Col2</th>
            <th>Col3</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>2</td>
            <td>3</td>
        </tr>
        <tr>
            <td colspan="2">Footer</td>
            <td>3</td>
        </tr>
    </tbody>
</table>

Is there a way of doing this? At the moment, I am only using dummy data, eventually it will be coming from the server (which can be ajax or even possibly SignalR)

Kind Regards

Sam

<Itable>
    <thead>
        <tr>
            <th>Col1</th>
            <th>Col2</th>
            <th>Col3</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>2</td>
            <td>3</td>
        </tr>
        <tr>
            <td colspan="2">Footer</td>
            <td>3</td>
        </tr>
    </tbody>
</table>
0
Dimiter Madjarov
Telerik team
answered on 20 Aug 2015, 07:11 AM

Hello Sam,

The Kendo UI Grid does not have a built it functionality for defining a footer row. It supports footer template and group footer template, which are used for displaying aggregated data.

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
Sam
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Sam
Top achievements
Rank 1
Share this question
or