I have the following setup:
| // IndexController contains array of search result objects
| IndexController (ArrayController)
| //Contains a search result object with row data (array) and search metadata
|
| // Contains just the row data which is rendered into a sortable table
|
IndexControllerretrieves a list of objects from the server when the user initiates a search. Each returned object has some search metadata and all row data.
Each object is visualized using an auxiliary element {{#each}}in the index template:
{{#each itemController="result"}}
{{view App.ResultView}}
{{/each}}
ResultView displays metadata and then displays the actual table with a helper {{render}}, like this:
<h2>{{pieceofMetaData}}</h2>
{{render "table" rows}}
( ), {{render}} TableController . , IndexController 3 , 3 TableControllers. TableController - ArrayController, , ArrayController . :
<table>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
{{#each}}
<tr>
<td>{{firstName}}</td>
<td>{{lastName}}</td>
</tr>
{{/each}}
</tbody>
</table>
, . ResultController TableController. ResultController , . , ResultController TableController.
needs: ['result'] "TableController", ResultController, .
jsbin , , .
http://emberjs.jsbin.com/paceqaki/7/edit
!
,