lightswitch05/table-to-json

To add <td id="value" in json data

Closed this issue · 1 comments

Hi

Firstly , Thanks for this amazing plugin, It saved lots of time

This is not an issue. Just I need some advice. How Could I get the td values ( <td id ="value") from each row and add it in JSON data ?

@Brhmts use extractor feature.

$('table').tableToJSON({
  extractor : function(cellIndex, $cell) {
    // get id from the cell, if empty or non-existant, get the cell text
    return $cell.attr('id') || $cell.text();
  }
});