Sharepoint Form - Change Dynamic DataTable Field Width

Hi Team

I am trying to change width of a Multi-line Text column in DataTable (data source is Sharepoint list), however i am unable to achieve this even after following the instruction mentioned in the Article.

I have DataTable contained in a Tab Control in a Sharepoint Form.

Also noticed that console.log is not logging anything in browser console (triggered in fd.spRendered event). I am using Chrome browser.

Hi @irfanz,

Try this script. Change the data table internal name, columns position and width only. It should works :ok_hand:

fd.spRendered(function() {
fd.control('SPDataTable1').ready().then(function(dt) {
var columns = $(fd.control('SPDataTable1').$el).find('col');
$(columns[2]).attr("style","width:350px");
$(columns[6]).attr("style","width:200px");
});
});

Hi @noorshahida88

Thank you for the reply.
I have tried this script after updating as per my data table configuration, however no change.

Also i am not seeing any output in browser console for console.log (within spRendered event). Dont know what is the issue.

@irfanz, remove or comment console line first and make sure internal name for your data table is correct.

Hi @noorshahida88

I have removed console line and checked for internal name which is correct, but their is no change to Column width

@irfanz, how many columns do you display for that data table? maybe that causing the issue because I had tried before for more than 10 columns; the script cannot works. Try with a few columns first and see if it is works for your environment.

@noorshahida88, I have tried with total columns in data table to be 8
However the issue presist, and no change to width of the required column

Any other Ideas?

@irfanz, there is limitation when we view the data table as it will fix to 1 page. So, I think can try to reduce the width size; 500px is too long for 8 columns table.


change your editing to Inline instead of dialog
image

image

Hello @noorshahida88, @irfanz,

Yes, it is a bit tricky to change the width of the columns in List or Library control.

Please find my reply in this thread:

@noorshahida88,

Thank you for sharing your knowledge! :slight_smile: You are already a guru in the styling of List or Library control.

1 Like

Thank you @mnikitina, this worked :slight_smile:

1 Like