I've tried adding custom html to have a button in a column but handsontable captures all the events.
Is there a way to have a save button in a column?
Thank you everyone for pointing me in the right direction.
I've added a column to the end of my handsontable:
{ data: "button", renderer: "html", readOnly: true }
In the "afterChange: function (change, source)"
I added:
row = change[0];
thisrow = row[0];
if (row[1] == "button") return
obj = data[thisrow];
var btn = '<input type="button" class="btn btn-primary btn-sm" value="save">'
$('#example1').handsontable("setDataAtCell", thisrow, 3, btn);
This adds a button to the last column when a cell is edited. I haven't bothered to check if the button is already there.
Finally, I capture the selection of the button cell:
Handsontable.PluginHooks.add('afterSelection', function (row, column) {
var current_td = this.getCell(row, column);
if (column != 3) return;
$('#example1').handsontable("setDataAtCell", row, 3, "");
// save a row here
});
You'll need to add the code to save the row.
--
You received this message because you are subscribed to a topic in the Google Groups "Handsontable" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/handsontable/pEkDpJA3M3k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to handsontable+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.