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?

4
  • Can you put your code in plunker? if its a scope issue then you can declare self=this; and use self.setvalidator(); Commented Mar 1, 2018 at 22:08
  • onCellClicked: function (params) { self=this; params.node.data["is_row_update"] = 1; seld.setValidator(); },not working Commented Mar 6, 2018 at 12:14
  • you need to declare self=this before you set the grid options. Before the function this.xxxsetgridOptions = {} Commented Mar 6, 2018 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? Commented Mar 27, 2018 at 18:30

1 Answer 1

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,                      
    };
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.