0

ブートグリッドは、一意の値の場合、数値以外の列 ID を識別子として使用できますか?

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

たとえば、 selection="true" は機能しますか? または、識別子列に数値が必要ですか?

4

1 に答える 1

2

OK、フィドルで試しました。数値以外の data-identifier を持つことができます(IMHOはdata-row-identifierと呼ばれるべきです...)

その列にアクセスするには、data-column-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);
    });

これがポイントを証明するためのjsfiddleです

于 2015-10-18T22:23:42.380 に答える