DataTable refresh Error

Hello Plumsail Team

I just have a small question about DataTables in the Forms where i want to achieve a functionality.

I have this DataTable and i have used this code to hide the first 2 columns which show the checkbox and edit button.

What i want to achieve is that when someone adds a new item or refreshes the table these buttons stay hidden but as soon as i enter a new entry or refresh the datatable the buttons appear again.
How can i work around this issue?

function HideControls(){
    fd.control('SPDataTable1').ready().then(function(dt){
        $('td:nth-child(1),th:nth-child(1)').hide();
        $('td:nth-child(2),th:nth-child(2)').hide();
    });
}
// Calling hideOrShowGrid when the Aufnahme value changes
fd.control('SPDataTable1').$on('change',HideControls);

// Calling hideOrShowGrid on form loading
HideControls();

image

Hello @Dario_Chiga,

You can use this code to remove the first two columns from the List or Library control:

fd.control('Control0').ready().then(function(dt) {
    var columns = dt.widget.columns        
    columns.splice(0,2);
    dt.widget.setOptions({
        columns: columns
    });
});

Cool Thank you that works.

Other question.
Is it possible to make some fields uneditable when editing the item.
i want to be able to click on new and then add a new item and only edit the fields "Thema" and "Text".

and then when someone else clicks on the row to edit only one field "Antwort" should be editable.

@Dario_Chiga,

You can disable specific column when editing control inline using the code:

fd.control('Control0').$on('edit', function(editData) {
    if (editData.formType === 'New') {
        console.log('editData.itemId');
        //Set Title field value with the value from the parent
        editData.field('Title').disabled = true;
    }
});

You can determine whether a new record is created or an existing one is edited by using a condition:

editData.formType === 'Edit'
1 Like

Perfect that works just how i want.
Thank you!