Plugin for creating an editable table from an array, textarea, table and not only. You can easily add and delete rows, cells. The plugin contains enough options and callback functions for quick customization for your task.
What will happen when creating a search page?
What will happen when editing?
Can I change rowspan or colspan?
What happens when the value in the stretched cell changes?
Добавляя в качестве колбека именованную функцию, параметр name может быть использован для определения метода который вызывает эту функцию.
Например
vartestFn=function(callbacks,index,args,name){if(name==='createRowAfter'){// some logic}elseif(name==='addTableAfter'){// another logic}else{// another logic tooreturnfalse;}returntrue;};$.TableEdid.callbacks.createRowAfter=testFn;$.TableEdid.callbacks.addTableAfter=testFn;
Refusal of this object is obvious. Instead, the properties must specify the functions passed to the $.TableEdit.init. This method will be more logical and similar to ECMAScript 2015.
How can i get the result HTML when i finished editing?
I have a container with a table in it and a button:
<div id="container"></div>
<button id="btn">Save</button>
<script type="text/javascript">
$(document).ready(function() {
$('#container').html($('#someotherfield.val());
var tableInContainer = $('#container').find('table').first();
tableInContainer.tableEdit({
compileTableAfter: function() {
$( this.table ).addClass('tableEdit');
},
eventsBindAfter: function() {
var button = $('#btn');
button.on('click', this, function(e) {
//@todo here i need some property or method of e.data to write the edited contents back to #container!
});
return true;
}
});
});
</script>
I've tried several properties/methods (e.g. dataTableObject, html, ...) but none of them could write the HTML table tag with original classes and colspans.
Serious problem with adding, removing rows and columns. On filtered pages, you can not get the correct index of a row from a taxonomy. The method "_getFrontRow" can not return a suitable row!