Hi,
I have setup a datastore ds_assign_students
that is updated with student IDs when clicked on a table row. When a unique student ID is updated/insterted in the datastore, I want to tick the checkbox for that row in the table and set table-success
class dynamically to highlight the selected rows.
I have tried contains
formatter to compare student ID values between the row that's clicked and ID saved in the datastore. But this doesn't work. There's no inArray
option available in the dynamic picker.
Any help in finding a solution to this issue is greatly appreciated. The code is as below:
<tbody is="dmx-repeat" dmx-generator="bs5table" dmx-bind:repeat="sc_list_students.data.q_list_students.data" id="tableRepeat2" key="id">
<tr dmx-class:table-success="ds_assign_students.data.contains(id)" dmx-on:click="run({run:{outputType:'text',action:`ds_assign_students.upsert({ds_student_id: id},{ds_student_id: id, ds_student_name: full_name})`}})">
<td dmx-text="full_name"></td>
<td dmx-text="year_level"></td>
<td dmx-text="class_name"></td>
<td>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="1" id="studentIdChecked" dmx-bind:id="'studentIdChecked'+$index" name="studentIdChecked" dmx-bind:checked="ds_assign_students.data.contains(id)">
<label class="form-check-label" dmx-bind:for="'studentIdChecked'+$index"></label>
</div>
</td>
</tr>
</tbody>