pashute
pashute

Reputation: 4063

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

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?

Upvotes: 0

Views: 1183

Answers (1)

pashute
pashute

Reputation: 4063

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

Upvotes: 2

Related Questions