【问题标题】:Will bootgrid work with non-numeric column-id as data-identifierbootgrid 将使用非数字列 ID 作为数据标识符吗
【发布时间】:2015-10-18 21:38:33
【问题描述】:

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

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

例如,selection="true" 会起作用吗?还是我需要标识符列的数值?

【问题讨论】:

    标签: jquery-bootgrid


    【解决方案1】:

    好的,在小提琴中试了一下。 您可以使用非数字数据标识符。 (恕我直言,它应该被称为 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);
        });
    

    Here's a jsfiddle to prove the point

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-08
      • 1970-01-01
      • 2014-09-02
      • 1970-01-01
      • 1970-01-01
      • 2018-04-14
      相关资源
      最近更新 更多