omkarkhair/jsonTable — pull request #4 by Dam-Buty (2013-08-15 22:43:46+00:00)
Title: Proposal for handling data-values attributes

Here's my proposal for adding HTML5 data-* attributes to the generated table, so that a line like this in the JSON :

```javascript
{ clientId: "154", clientName: "John Locke", food: { display: "Bacon", value: "23" } }
```

Will generate a line like this in HTML :

```HTML

John Locke
Bacon

```

This way, I can display Bacon, but get its database id from the cell's data-value. Similarly, i can get the client's database id from the row's data-value. You get the idea.

My proposal is :
- In the constructor, i added an "id" option, which specifies the JSON identity whose value will be put in the row's data-value. In this example :
```javascript
$("#myTable").jsonTable({
head : ["Client name", "Fave food"],
json : ["clientName", "food"],
id: "clientId"
});
```

- In the JSON used to update the table, each entity can be a string (normal behaviour) or an object with "value" and "display" options, which will be put respectively in the data-value of the cell and inside the td.

I needed it for my app, so i thought maybe it might benefit the plugin? I also rewrote the updateFromObj() function a bit, hope you don't mind.

Cheers,
D