Maybe dumb question - how to add columns when user click "add" to create new row
Maybe dumb question - how to add columns when user click "add" to create new row
I have datatable with some rows displayed but not editable.
When user clicks TableTools "Add" button I want them to be able to able to fill in the columns which are not editable on rows that exist....
In other words, once they enter data in a new row for a particular column (ed. District) they cannot change it.
In other words - normal editing is just to edit one column, but add requires entering a few more columns
does this make sense?
Can it be done? or better to have a separaet complete program/Datatable/Editor for this?
Replies
If I understand correctly, I would suggest you using
initCreate
andinitEdit
with theenable()
anddisable()
methods.For example:
Is that what you are looking for?
Allan
I think so - trying it now
Almost got it.
$('#aeecs').on( 'initCreate', function () {
editor.enable( 'District' );
} );
$('#aeecs').on( 'initEdit', function () {
editor.disable( 'District' );
} );
So I can add the field to add/edit form, but my disable code is not working
$('#aeecs').on( 'initCreate', function () { editor.enable( 'District' ); } );
$('#aeecs').on( 'initEdit', function () { editor.disable( 'District' ); } );
it is close enough for now, I can allow them to edit
If you don't want to show the field at all, use
hide()
andshow()
.What is the field type for
District
? Is it a plug-in?Allan
district is just a varchar/text input - thanks!