I am using Bootstrap-Table Cn
I have a table. I want to pre-check certain rows. However when I add class="selected"
to my or table row, upon loading the table in, Bootstrap-Table removes the class selected and unchecks it. How can I preserve the initial checkbox selected, before the table loads?
Update: I am not creating checkbox inputs. I am using BootStrap Tables CN to generate the checkboxes for me.
Here is the code.
<table id="storeTable" class="table table-bordered table-hover" style="width:100%" data-toggle="table" data-search="true" data-toolbar="#toolbar" data-pagination="true" data-side-pagination="client" data-show-pagination-switch="true" data-page-list="[10, 25, 50, ALL]" data-click-to-select="true" data-filter>
<thead>
<tr>
<th data-sortable="true" data-checkbox="true">
</th>
<th data-field="cg" data-sortable="true">
@Html.DisplayNameFor(model => model.dealeradminstore[0].cg)
</th>
<th data-field="sn" data-sortable="true">
@Html.DisplayNameFor(model => model.dealeradminstore[0].serial_number)
</th>
<th data-field="name" data-sortable="true">
@Html.DisplayNameFor(model => model.dealeradminstore[0].Name)
</th>
<th data-sortable="true">
WebReports
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.dealeradminstore)
{
<tr id="@test.NullRefExcl(item.serial_number.ToString())" checked>
<td></td>
<td>
@test.NullRefExcl(item.cg.ToString())
</td>
<td>
@test.NullRefExcl(item.serial_number.ToString())
</td>
<td>
@test.NullRefExcl(item.Name)
</td>
<td>
@{string reportsCheck = "";
if (test.NullRefExcl(item.base_xtags).Contains("RPT"))
{
reportsCheck = "Yes";
}
if (!test.NullRefExcl(item.base_xtags).Contains("RPT"))
{
reportsCheck = "No";
}
}
@test.NullRefExcl(reportsCheck)
</td>
</tr>
}
</tbody>
</table>