jquery - Use handsontable with an existing table -
do know if can use hansontable jquery plugin table exists ?
because in documentation, saw can create table handsontable :
var data = [ ["", "kia", "nissan", "toyota", "honda"], ["2008", 10, 11, 12, 13], ["2009", 20, 11, 14, 13], ["2010", 30, 15, 12, 13] ]; var $container = $("#example1"); $container.handsontable({ data: data });
but wish :
$("#montableau").handsontable();
in order give handsontable's feature table
do have idea please ?
workaround:
var data = []; $('#montableau tr').each(function(index,el){ var rowdata = []; $(el).children().each(function(index,el){ rowdata.push($(el).html()); //or use text() if u prefer }); data.push(rowdata); }); el = $('#montableau').after('<div class="handsontable"></div>').next(); $('#montableau').remove(); el.handsontable({ data : date });
or extend library make possible.