0

I have created

    this.xxxsetgridOptions = {
        rowSelection: 1,
        columnDefs: this.setvsp_param_columns,
        onCellClicked: function (params) {
            params.node.data["is_row_update"] = 1;
            this.setValidator();


        },
        getRowStyle:function(params){
            if(params.data.is_new_rec==1) {
                return {'background-color': 'rgb(192,192,192)'}
             }
        },
        suppressScrollOnNewData:true,
        rowHeight:28,                      
    };

this is this.setValidator(); component's function. so i want to call this function when ag grid cell clicked? how to call this in angular 2?

koolhuman
  • 1,581
  • 15
  • 25
Pratik
  • 11
  • 1
  • 6
  • Can you put your code in plunker? if its a scope issue then you can declare self=this; and use self.setvalidator(); – koolhuman Mar 01 '18 at 22:08
  • onCellClicked: function (params) { self=this; params.node.data["is_row_update"] = 1; seld.setValidator(); },not working – Pratik Mar 06 '18 at 12:14
  • you need to declare self=this before you set the grid options. Before the function this.xxxsetgridOptions = {} – koolhuman Mar 06 '18 at 15:12
  • does the below answer solve your problem? If so could you please accept it so other users having the same question can be benefited? – koolhuman Mar 27 '18 at 18:30

1 Answers1

2
self=this;

this.xxxsetgridOptions = {
        rowSelection: 1,
        columnDefs: this.setvsp_param_columns,
        onCellClicked: function (params) {
            params.node.data["is_row_update"] = 1;
            self.setValidator();


        },
        getRowStyle:function(params){
            if(params.data.is_new_rec==1) {
                return {'background-color': 'rgb(192,192,192)'}
             }
        },
        suppressScrollOnNewData:true,
        rowHeight:28,                      
    };
koolhuman
  • 1,581
  • 15
  • 25