Skip to content

Error on opening custom cell editor who's first element has no select method. #4193

@lukee910

Description

@lukee910

I use a custom editor template to edit a few cells. Everytime I open that cell editor it throws an error at this line saying TypeError: $elm[0].select is not a function. Wich is true, the first element's select funtion is undefined.

Now my question: Am I doing something wrong here? And if not, shouldn't this error be handled? (If it's really a bug I'd love to create a pull request to fix it)

This line:

if ($scope.col.colDef.enableCellEditOnFocus || !(uiGridCtrl && uiGridCtrl.grid.api.cellNav)) {
    console.log($elm[0].select);
    $elm[0].select = function(){}
    $elm[0].select();
}

My custom editor template, a simple-ish dropdown:

<div>
    <form name="inputForm">
        <ol class="nya-bs-select form-control btn-sm inverse" ui-grid-edit-dropdown ng-model="MODEL_COL_FIELD" size="8" ui-grid-editor data-live-search="true" title="---">
            <li nya-bs-option="option in editDropdownOptionsArray" value="option.value" title="{{option.title || option.value}}">
                <a href>{{(option.title || option.value) === '' ? '---' : (option.title || option.value)}}</a>
            </li>
        </ol>
    </form>
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions