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

北城以北 提交于 2019-12-12 02:27:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!