Change Data Table column width to percentage of window size

Hi there, I'm using a Data Table object to gather three items - a person's name, age and a boolean yes/no.

I want to set the column width using a percentage of window width, to keep the Name column to be 70% of the window width. That way, regardless of the device type, the name is the widest.

I'm trying the following code which doesn't work:

fd.control('tblMemberNames').columns[1].width = Math.round($(window).width()*0.7);

Is there a way to make this work? I thought it might be like a table, where if you define a column width of the first column then the remainder share the rest of the window width.

Interesting, even if I set the width of the first column in the Design mode, then querying it with the .width code above returns "undefined".

Thanks
Mark

Dear @RME,
Try setting the width of the column like this:

var dataTable = fd.control('DataTable1');
var column = dataTable.widget.columns[0];
var width = Math.round($(window).width()*0.7);
dataTable._saveColumnWidth(column, width);
dataTable.widget.resizeColumn(column, width);

Hi, could you provide same sample but for Height?

I have a DataTable inside Tab, and i would like to resize datatable to maximum height of window.

WF

Sorry, I've mistaken control. I'll create separated thread.