is it possible to disable the sorting for data table.
I am also trying to hide the delete button from data table , On form load, it is hidden, After making changes to data table , delete button appears again.
fd.spRendered(function () {
fd.control('mytable').$on('change', function () {
calculateTotal();
});
fd.control("mytable")
.ready()
.then((el) => {
var dt = $(fd.control('mytable').$el);
dt.find('.fd-datatable table tr th:last-child,.fd-datatable table tr td:last-child').css('display', 'none');
});
});
Dear @sanaullah102 ,
Please, try the following:
fd.spRendered(function () {
var dt = fd.control('DataTable1');
var columns = dt.widget.options.columns;
//remove last column (delete column)
columns.pop();
dt.widget.setOptions({
columns: columns
});
//make non-sortable
dt.widgetOptions = {
sortable: false
};
});
Sorting is still available ( visible), Delete button is removed successfully
Below is the code
fd.spRendered(function () {
fd.control('BloodTaking').$on('change', function () {
calculateTotal();
});
//Set values
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
//disable button - not allowed to edit
fd.field('FormStatus').ready().then(function (field) {
fd.field('FormStatus').disabled = true;
});
setToolbarButtons();
var dt = fd.control('BloodTaking');
var columns = dt.widget.options.columns;
//remove last column (delete column)
columns.pop();
dt.widget.setOptions({
columns: columns
});
//make non-sortable
dt.widgetOptions = {
sortable: false
};
});
//spRendered end
Dear @sanaullah102 ,
What do you mean by sorting is visible? Do you mean filtering is visible? Sorting should be disabled when you click on a column. Please, attach a screenshot of what's visible and you want to hide.
Dear @sanaullah102 ,
What version of Forms are you running? Click the icon and select About:
That definitely shouldn't be the case, try to remove the rest of JavaScript from the form while testing, and leave just this:
fd.spRendered(function () {
var dt = fd.control('BloodTaking');
var columns = dt.widget.options.columns;
//remove last column (delete column)
columns.pop();
dt.widget.setOptions({
columns: columns
});
//make non-sortable
dt.widgetOptions = {
sortable: false
};
});
Dear @sanaullah102 ,
Please, try the following:
fd.spRendered(function () {
var dt = fd.control('BloodTaking');
dt.ready(()=>{
//make non-sortable
dt.widgetOptions = {
sortable: false
};
});
});
Its still does not work, Even I remove all other code , Just added the above code, to make sure that its not effected by some other code.
Dear @sanaullah102 ,
Please, make sure you have the latest version v1.9.0 installed - Update Plumsail Forms On-Premises solution — SharePoint forms
And check console for errors, post a screenshot here if there are any errors.
Nikita_Kurguzov:
v1.9.0 installed
Ok Noted, let me update to v1.9.0