Angular 4 - Using Update Settings (Make Col 0 Read Only with Dynamic table)

Hello,

I’ve spent a day on this and haven’t found a solution. The goal is the freeze column 1 and have it read only. This field is going to be data that gets calculated (server side) based on what they paste into the rest of the spreadsheet (copied from excel most likely but doesn’t have to be excel). The spreadsheet needs to remain dynamic in both # of columns and # of rows.

The thing I’m struggling with is making the first column read only. I seem to be able to set fixed columns and have it read only, but I can’t do it with a dynamic table. I found this script somewhere (though I’ve modified it a bit), so it works, but how do I implement this within the Angular wrapper is what’s puzzling me.

hot.updateSettings({
cells: function (row, col) {
var cellProperties = {};
if (col === 0) { cellProperties.readOnly = true; }
return cellProperties;
}
});

Also, ideally I’d like to have the first column header named “Result” then continue the table A, B, C etc. What I plan to do is manipulating this table each time it gets altered with events.

Hi @slam

here is an example in Angular https://stackblitz.com/edit/angular-mzkjyu?file=src/app/hello.component.ts

You can change the columns name by the colHeaders function like here https://stackblitz.com/edit/angular-ddsoa3?file=src/app/hello.component.ts

1 Like

Hello,

I’ve been getting “Can’t bind to ‘settings’ since it isn’t a known property of ‘hot-table’.”. Is this because I’m using Angular 4 with package ng2-handsontable package 2.1.0-rc.3 ?

I seem to have been able to do it with options instead.

It might be a reason, or you haven’t completed the template for the component. Nevertheless I highly encourage to update the wrapper and Handsontable version as now they both are more stable.