Reputation: 477
i have to implement jquery ui accordion and sortable in asp.net mvc dynamically generated table rows. i have implemented sortable and its working fine but how can i impelement accordion to table tbody.
<table >
<tbody id="rowAccordion">
@foreach (var item in Model)
{
<tr class="rowSort">
<td style="width: 200px;">
<h3>
<a href="#">@item.PageTitle</a>
</h3>
<div>
<p>
Discription
</p>
</div>
</td>
</tr>
}
</tbody>
</table>
<script>
$(function () { $("#rowAccordion").accordion(); });
$("#rowAccordion").sortable();
</script>
Upvotes: 0
Views: 498
Reputation: 2936
Use the option "header" using the column that you want to appear as the header.
$(document).ready(function () {
$("#rowAccordion").accordion({header: 'YOUR COLUMN SELECTOR HERE' });
});
hth
Upvotes: 1