bootgrid 将使用非数字列 id 作为数据标识符

Will bootgrid work with non-numeric column-id as data-identifier

bootgrid 是否可以使用非数字列 ID 作为标识符(如果它是唯一值)?

<th data-column-id="mytextid" data-identifier="true">Unique Text ID</th>
例如,

selection="true" 会起作用吗?或者我是否需要标识符列的数值?

好的,在 fiddle 中试过了。 您可以使用非数字数据标识符。 (恕我直言,它应该被称为 data-row-identifier...)

为了访问该列,您只需使用您在数据列标识符中设置的名称,因此:

        <!-- 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>

代码应该是

    $("#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