问题
see this js fiddle[http://jsfiddle.net/pUAXd/17/] i am creating my table in html body and want to use drag and copy functionality of dooly.js over my table like the 2nd table..
回答1:
You just need to grab the data from the table before the rederizartion and then use this data to create the table with dolly.js
tableController.element = $("table");
tableController.data = [];
tableController.element.find('tr').each(function(i, line) {
var lineData = [];
$(line).find('td').each(function(j, cell) {
lineData.push($(cell).html());
});
tableController.data.push(lineData);
});
tableController.render();
I've updated the fiddle for you: http://jsfiddle.net/pUAXd/66/
I hope it helps.
来源:https://stackoverflow.com/questions/21902079/how-to-use-dolly-js-over-already-define-html-table-for-functionality-of-excel-li