views:

352

answers:

1

The following Server-Side code works:

[OperationContract]
public IEnumerable<object> GetBooks() {
    var people = new List<object>
                     {
                        new Book{ Author="Richard Preston", Title="The Hot Zone"},
                        new Book{ Author="Jim Norton", Title="I Hate Your Guts"}
                     };
    return people.AsEnumerable();
}

Here is a portion of the Client-Side code:

<table class="Template">
    <thead>
        <tr>
            <th>Author</th>
            <th>Title</th>
        </tr>
    </thead>
    <tbody id="bookListView">
        <tr>
            <td>{{Author}}</td>
            <td>{{Title}}</td>
        </tr>
    </tbody>
</table>

function pageLoad() {
    $create(Sys.UI.DataView, { serviceUri: "MyService.svc", query: "GetBooks" }, {}, {}, $get("bookListView"));
}

I'd like to be able to return a DataTable to the client, and populate the client template by simply referencing each column's name. Is that possible?

+1  A: 

Delayed answer, but yes -- I think what you are missing is class="sys-template" on the bookListView tbody.

InfinitiesLoop