Grid RowTemplate Problems

4 posts, 0 answers
  1. Sam
    Sam avatar
    3 posts
    Member since:
    Dec 2014

    Posted 14 Aug 2015 Link to this post

    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

  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2299 posts

    Posted 18 Aug 2015 Link to this post

    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
  3. Sam
    Sam avatar
    3 posts
    Member since:
    Dec 2014

    Posted 18 Aug 2015 in reply to Dimiter Madjarov Link to this post

    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>
  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2299 posts

    Posted 20 Aug 2015 Link to this post

    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
Back to Top