I have tried this link http://jsfiddle.net/jlspake/v2L1ny8r/7/ but no any luck.
my ts code is here
var viewModel = function(data){
var self = this;
self.orders = ko.observableArray([
{
table_name: 'Table A1 order ID : 001',
tabledata: [
{ s_no: 1, time: '00:10:00', item_name: 'Carrot Jus', qty: 1, service_type: 'Dine-In', variants: '', ingredients: '', parcel: '', comments: '', status: 'Complete' },
{ s_no: 2, time: '00:10:00', item_name: 'Orange Juice', qty: 1, service_type: 'Takeaway', variants: '', ingredients: '', parcel: '', comments: '', status: 'Complete' },
{ s_no: 1, time: '00:10:00', item_name: 'Carrot Jus', qty: 1, service_type: 'Dine-In', variants: '', ingredients: '', parcel: '', comments: '', status: 'Complete' },
{ s_no: 2, time: '00:10:00', item_name: 'Orange Juice', qty: 1, service_type: 'Takeaway', variants: '', ingredients: '', parcel: '', comments: '', status: 'Complete' }
]
},
{
table_name: 'Table A1 order ID : 001',
tabledata: [
{ s_no: 1, time: '00:10:00', item_name: 'Rice', qty: 1, service_type: 'John', variants: '', ingredients: '', parcel: '', comments: '', status: 'Complete' },
{ s_no: 2, time: '00:15:00', item_name: 'Chicken', qty: 1, service_type: 'John', variants: '', ingredients: '', parcel: '', comments: '', status: 'Complete' }
]
}
]);
}
ko.applyBindings(new viewModel(null));
I have used html table to loop . HTML Code:
<table class="table table-hover">
<thead>
<tr>
<th>S NO</th>
<th>Time</th>
<th>Item name</th>
<th>Qty</th>
<th>Service Type</th>
<th>Variants</th>
<th>Ingredients</th>
<th>Parcel</th>
<th>Comments</th>
<th>Status</th>
</tr>
</thead>
<tbody id="sortable" data-bind="foreach: orders">
<tr class="ui-state-default ui-state-disabled">
<td colspan="3" class="ui-state-default" data-bind="text: table_name"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr data-bind="foreach: tabledata">
<td class="ui-state-default" data-bind="text: s_no"></td>
<td class="ui-state-default" data-bind="text: time"></td>
<td class="ui-state-default" data-bind="text: item_name"></td>
<td class="ui-state-default" data-bind="text: qty"></td>
<td class="ui-state-default" data-bind="text: service_type"></td>
<td class="ui-state-default" data-bind="text: variants"></td>
<td class="ui-state-default" data-bind="text: ingredients"></td>
<td class="ui-state-default" data-bind="text: parcel"></td>
<td class="ui-state-default" data-bind="text: comments"></td>
<td class="ui-state-default" data-bind="text: status"></td>
</tr>
</tbody>
</table>
I want to show nested json data in table. How can it be possible? Please guide some solution. I would really appreciate it. Thanks in advance.
