rstaib / jquery-bootgrid

Nice, sleek and intuitive. A grid control especially designed for bootstrap.
http://www.jquery-bootgrid.com
MIT License
973 stars 364 forks source link

Row object not returned correctly when using row identifier #175

Open philwig opened 9 years ago

philwig commented 9 years ago

If you have a click handler on a row, the row object a list of columns are returned by the Bootgrid click handler. That's all good.

If you then add a data-identifier parameter to some field, to use as the row ID.... the row is then returned from that same click handler as null. The reason is this pair of lines...

id = (that.identifier == null) ? $this.data("row-id") :  that.converter.from($this.data("row-id") + ""),

This one sets my ID up to be a string, say "4". The subsequent line...

row = (that.identifier == null) ? that.currentRows[id] :
                    that.currentRows.first(function (item) { return item[that.identifier] === id; });

compares for type and value with === against... the objects in the array. And that danged ID is plain old integer 4 in there. So it fails the comparision, as 4 !== "4".

I'm not quite sure what this is supposed to be doing, but a quick hack fix is to relax the test to make it an == check. That seems unsatisfying.

EdwardsNick commented 8 years ago

@philwig

See pull request #280