ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

External Scope attribute not working in row template

Open axschech opened this issue 12 years ago • 4 comments

The externalScopes attribute doesn't seem to be allowing me to access the external scope function from within a custom row template. Perhaps I'm doing something wrong still?

Controller function -

$scope.theClick = function()
        {
            console.log("clicked");
        }

HTML -

<div style="width:1000px; height:500px" ui-grid-selection ui-grid="gridOptions" externalScopes="theClick()"></div>

Row Template -

function rowTemplate() {
            return '<div context-menu ng-click="theClick()" ng-repeat="col in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ui-grid-cell data-target="myMenu"></div>';
}

axschech avatar Aug 07 '14 18:08 axschech

see 202 External Scopes tutorial. You must use getExternalScopes() in your templates to access your external scope variable. You can't put the function on the attribute. You can put the function name. But I would recommend created a container property to holde these functions @scope.viewModel = {theClick:function(){}} externalScopes="viewModel"

swalters avatar Aug 07 '14 19:08 swalters

How to use getExternalScopes() on subgrids expandabled rows from templates

jawaharlalt avatar Nov 06 '14 09:11 jawaharlalt

How to add modal dialog on click of a button in subgrid using external scopes?

ruchakudale avatar Nov 26 '14 04:11 ruchakudale

Got the solution. Check this link for answer https://github.com/angular-ui/ng-grid/issues/1782

ruchakudale avatar Nov 26 '14 05:11 ruchakudale