问题
will bootgrid work with non numeric column-id as the identifier, if its a unique value?
<th data-column-id="mytextid" data-identifier="true">Unique Text ID</th>
Will selection="true" work for instance? Or do I need a numeric value for the identifier column?
回答1:
OK tried it in fiddle. You can have a non numeric data-identifier. (IMHO it should be called data-row-identifier...)
In order to access that column you simply use the name you set in the data-column-identifier, so:
<!-- works!! even without data-type="numeric" -->
<th data-column-id="myid" data-identifier="true">My ID</th>
<th data-column-id="info">Info</th>
</tr>
</thead>
and the code should be
$("#mygrid").bootgrid(
{
// other settings... and:
selection: true
}).on("selected.rs.jquery.bootgrid", function(e, rows)
{
alert("Selected: " + rows[0].myid);
});
Here's a jsfiddle to prove the point
来源:https://stackoverflow.com/questions/33203560/will-bootgrid-work-with-non-numeric-column-id-as-data-identifier