Skip to content

.ui-grid-cell-contents events when using directive in headerCellTemplate #5996

@cooljingle

Description

@cooljingle

I am specifying a custom headerCellTemplate which contains a directive. In such a situation the directive template won't render until after the parent ui-grid directive has run through its link, which contains the following
var $contentsElm = angular.element( $elm[0].querySelectorAll('.ui-grid-cell-contents') );
and then assigns various events to this element.

Unfortunately my header cell will not get these events bound as the relevant DOM doesn't exist yet. This can be fixed fairly easily with delegated events e.g.
$contentsElm.off('click', $scope.clickFn); becomes
$elm.off('click', '.ui-grid-cell-contents', $scope.clickFn);

I'll submit a PR for this shortly.

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