Bootgrid将使用非数字列ID作为数据标识符工作 [英] Will bootgrid work with non-numeric column-id as data-identifier

查看:81
本文介绍了Bootgrid将使用非数字列ID作为数据标识符工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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>

例如,selection ="true"会起作用吗?还是在标识符列中需要一个数字值?

Will selection="true" work for instance? Or do I need a numeric value for the identifier column?

推荐答案

OK尝试了小提琴. 您可以使用非数字数据标识符. (恕我直言,它应该称为 data-row-identifier ...)

OK tried it in fiddle. You can have a non numeric data-identifier. (IMHO it should be called data-row-identifier...)

为了访问该列,您只需使用您在data-column-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>

,代码应为

    $("#mygrid").bootgrid(
    {
        // other settings... and: 
        selection: true
    }).on("selected.rs.jquery.bootgrid", function(e, rows)
    {
        alert("Selected: " + rows[0].myid);
    });

这里是一个jsfiddle来证明这一点

这篇关于Bootgrid将使用非数字列ID作为数据标识符工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆