Display fields and columns conditionally
Display fields and columns conditionally
hbanaharis
Posts: 32Questions: 14Answers: 3
in Editor
I'm able to control the display of editing buttons and inline editing by an if statement, eg
if (permission === 'admin') {
$('#mydataTable').on( 'click', 'tbody td:not(.child)', function (e) {
if ( $(this).hasClass( 'control' ) || $(this).hasClass('select-checkbox') ) {
return;
}
editor.inline( this, {onBlur: 'submit'} );
} ); };
But how can I conditionally display the fields in editor and columns in datatable?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
For the table, you can call
column().visible()
- this will hide the column. For the Editor form, you can callfield().disable()
.This example from this thread should help, it's conditionally hiding an Editor field.
Colin
thanks Colin,
table.column( n ).visible( false, false );
works