handsontable / ngHandsontable

Official AngularJS directive for Handsontable
http://handsontable.github.io/ngHandsontable/
MIT License
433 stars 159 forks source link

Unable to call angular function from in-cell button #224

Closed johnothetree closed 6 years ago

johnothetree commented 6 years ago

I have a hot-table setup to show 4 columns with data in the first 3 cells of each row, and a button in the 4th row to then run a function for that row. When i click the button, I expect the ng-click function to run, but nothing happens.

Here's what we see in the UI: image

table:

<hot-table settings="{colHeaders: ['Params', 'Pct', 'ID', 'Options'], columnSorting:true, sortIndicator:true}" row-headers="false" height="300" width="700" datarows="$ctrl.datarows" columns="$ctrl.columns" ></hot-table>

columns obj:

this.columns = [
    {
      data: 'params',
      title: 'Params',
      readOnly: true
    },
    {
      data: 'pct',
      title: 'Pct'
    },
    {
      data: 'id',
      title: 'ID'
    },
    {
      data: 'html',
      title: 'Options',
      readOnly: true,
      renderer: "html"
    }
];

example datarows obj:

this.datarows = [
    {
        "params": "G=M",
        "id": 0,
        "pct": 100,
        "vtMap": [
            {
                "id": 0,
                "params": "G=M"
            }
        ],
        "html": "<button ng-click=\"$ctrl.function(params)\">Click Me!</button>"
    },
    {
        "params": "G=F",
        "id": 0,
        "pct": 100,
        "vtMap": [
            {
                "id": 0,
                "params": "G=F"
            }
        ],
        "html": "<button ng-click=\"$ctrl.function(params)\">Click Me!</button>"
    }
];

Is what I'm trying to do not possible? Or is there something i'm missing? Any help is appreciated!

johnothetree commented 6 years ago

Note: i've also just tried putting ng-click='alert("Hello, World!")' instead of a function call and that also didn't work, which makes me think that I can't do an ng-click button within a cell...

AMBudnik commented 6 years ago

Related issue https://github.com/handsontable/handsontable/issues/4639

AMBudnik commented 6 years ago

The issue https://github.com/handsontable/handsontable/issues/4639 has been solved and closed