I have a set number of available columns in html table. As soon as the user will filter out which columns they want I'm displaying the table with the selected columns only.
Now, I want to give the option to the user to also set the order of the columns displayed, which column to come first, which second. I have the list and the functionality for reordering the columns in a select list ready, please check the screenshot below:
I want to know how can I actually sort the columns in the table in the same order as they are set in the list on the right.
This is the code I have so far:
<table class="table table-hover" id="basicTable">
<thead>
<tr>
<th ng-show="ShowDescription">Description</th>
<th ng-show="ShowDeviceId">Device ID</th>
<th ng-show="ShowUpdateRequired">Update Required</th>
<th ng-show="ShowOpenTime">Open Time</th>
<th ng-show="ShowOpenTimeAda">Open Time Ada</th>
<th ng-show="ShowKeypadCode">Keypad Code</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="(k, v) in assets | filter: appliedFilter">
<td class="v-align-middle" ng-show="ShowDescription">
<p>{{v.description}}</p>
</td>
<td class="v-align-middle" ng-show="ShowDeviceId">
<p>{{v.extdoorid}}</p>
</td>
<td class="v-align-middle" ng-show="ShowUpdateRequired">
<p><span ng-if="v.updaterequired == '1'">Yes</span><span ng-if="v.updaterequired == '0'">No</span></p>
</td>
<td class="v-align-middle" ng-show="ShowOpenTime">
<p>{{v.opentime}}</p>
</td>
<td class="v-align-middle" ng-show="ShowOpenTimeAda">
<p>{{v.opentimeada}}</p>
</td>
<td class="v-align-middle" ng-show="ShowKeypadCode">
<p>{{v.keypadcode}}</p>
</td>
</tr>
</tbody>
</table>
