U.P
U.P

Reputation: 7442

jqGrid on column header click event

I am using jquery and jqGrid and I am looking for an oncolumnheader (or something similar) click event. I have used the "onSortCol:" property of grid but it is not giving me the DOM object on which the click is done. Is there a function or any way to hook click event to a column header in jqGrid?

Thanks in Advance,

Upvotes: 1

Views: 12913

Answers (3)

Haryono
Haryono

Reputation: 2812

Some body that could not achieve above answers can try below code:

 $(".ui-th-column").click((e) => {
            // get the data info of the "e" object from there.
  }); 

Upvotes: 0

user749687
user749687

Reputation:

Try applying your click event after the grid has been created using the gridComplete event. http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events

gridComplete: function(){ 
    $("#id-of-your-grid th").click(function() {...});
}

Upvotes: 3

joostdevries
joostdevries

Reputation: 930

The column headers are th elements so it will probably be as easy as:

$("#id-of-your-grid th").click(function() {...});

Upvotes: 2

Related Questions