Is there a way to scroll the indices of observable knockout attributes, like with a for loop in C # or Java?
With the code below, I just grab onto the first index (0), but I want to be able to scroll through the indexes and get values ββfrom them as they appear
<table class="table table-hover table-bordered table-condensed"> <thead> <tr> <th> <input type="checkbox" data-bind="checked: SelectAll" value="0" /> </th> <th>Employee Name</th> <th>Sun</th> <th>Mon</th> <th>Tue</th> <th>Wed</th> <th>Thu</th> <th>Fri</th> <th>Sat</th> </tr> </thead> <tbody data-bind="foreach: Items"> <tr> <td> <input type="checkbox" class="entity-id" data-bind="if: Timesheets()[0].RowID == 0, checked: IsChecked" /> </td> <td><a class="span8" data-bind="if: Timesheets()[0].RowID == 0, text: EmployeeName, attr: { rowspan: Timesheets()[0].RowSpan }"></a> </td> <td><input type="text" class="span6" data-bind="value: Timesheets()[0].SundayHours"/> </td> <td><input type="text" class="span6" data-bind="value: Timesheets()[0].MondayHours" /></td> <td><input type="text" class="span6" data-bind="value: Timesheets()[0].TuesdayHours"/></td> <td><input type="text" class="span6" data-bind="value: Timesheets()[0].WednesdayHours"/></td> <td><input type="text" class="span6" data-bind="value: Timesheets()[0].ThursdayHours"/></td> <td><input type="text" class="span6" data-bind="value: Timesheets()[0].FridayHours"/></td> <td><input type="text" class="span6" data-bind="value: Timesheets()[0].SaturdayHours"/></td> </tr> </tbody> </table>
Is there a way to do this with a knockout?
source share