从列名获取列号

Cor*_*ell 5 handsontable

有没有什么方法可以从列名中获取列号?

我只能检索列名称,并且我需要 getCellMeta 的列号。

谢谢

Cor*_*ell 3

做了这个函数解决了我的问题:

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
}
Run Code Online (Sandbox Code Playgroud)