Is there any method to get the column number from the column name?
I can only retrieve the column name, and I need the column number for getCellMeta.
Thanks
Is there any method to get the column number from the column name?
I can only retrieve the column name, and I need the column number for getCellMeta.
Thanks
Made this function that solved my problem:
function GetColFromName(name)
{
var n_cols = $editorTableContainer.handsontable('countCols');
var i = 1;
for (i=1; i<=n_cols; i++)
{
if (name.toLowerCase() == $editorTableContainer.handsontable('getColHeader', i).toLowerCase()) {
return i;
}
}
return -1; //return -1 if nothing can be found
}
This is almost what I required but not quite as I needed the column prop. I couldn't find the answer anywhere so thought I would add this to the thread that helped me.
instead of using 'getColHeader' use 'colToProp'.
Use propToCol("Column Name")
. This returns the column's index.
© 2022 - 2024 — McMap. All rights reserved.