Make column in a Data Grid with editType CHECKBOX readonly

How to make a column in a Data Grid with editType CHECKBOX (and some others) readonly (at design time)?

Servoy Developer 202206

Best regards

Hi Robert,

I believe this can be done by using the ‘isEditableDataprovider’ (column property)
If you want it read only, you should assign a dataprovider that returns false.

Hope this helps

Hi Marc

Many thanks - works as you say.

It did help :-)

Best regards,

Thanks for that tip.
On a similar theme how would we show/hide a column on Data Grid programatically in NG client.

Hello Antonio,

You can do that in a function, for example on Load.
Just loop over the columns and do your needed if-s etc.

/**
 * Callback method when form is (re)loaded.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"630DDFF5-8352-4EF0-8FC3-137CD9DD6E40"}
 */
function onLoad(event) {
	/** @type {CustomType<aggrid-groupingtable.column>} */
	var columns = elements.datagrid_1.columns;
	for (var index = 0; index < columns.length; index++) {
		columns[1].columnDef = {
			suppressMenu: true
		}
		columns[1].visible = false;
	}
}

Or if you only need a specific column.

	/** @type {CustomType<aggrid-groupingtable.column>} */
	var col2= elements.datagrid_1.columns[2];
	col2.columnDef= {
		suppressMenu: true
	}
	col2.visible= false;