Sai Avinash
Sai Avinash

Reputation: 4753

Jqgrid Drop down not triggering OnChange Event

I am working on jqgrid. I have a column which has drop down list inside it.

I am binding change event on dropdown. But, it is not getting triggered. I was confused about where to mention the dataEvents.

Code:

   beforeProcessing: function (response) {
                            var $self = $(this);
                            $self.jqGrid("setColProp", "Country", {
                                formatter: "select",
                                edittype: "select",
                                editoptions: {
                                    value: $.isPlainObject(response.Mapping) ? response.Mapping : []
                                },
                                dataEvents: [
                                {
                                    type: 'change',
                                    fn: function (e) {
                                        alert("I am fired by the key press event of text box inside jqgrid");
                                    }
                                }
                                ]
                            });
                        },

I am not getting any error..but the event is not triggered. Please help .

Upvotes: 0

Views: 3376

Answers (1)

Sai Avinash
Sai Avinash

Reputation: 4753

I fixed this issue. The problem is that DataEvents is the property of Editoptions. I misplaced it..

This might be useful for some one ..Thanks

beforeProcessing: function (response) {
                            var $self = $(this);
                            $self.jqGrid("setColProp", "Country", {
                                formatter: "select",
                                edittype: "select",
                                editoptions: {
                                    value: $.isPlainObject(response.Mapping) ? response.Mapping : [],
                                dataEvents: [
                                {
                                    type: 'change',
                                    fn: function (e) {
                                        alert("I am fired by the change event of drop down inside jqgrid");
                                    }
                                }
                                ]
                              }
                            });
                        },

Upvotes: 4

Related Questions