-
21 Jan 2010 2:15 AM #1
How to call a javascript function on column header click in ext js grid?
How to call a javascript function on column header click in ext js grid?
Hi Team,
I am having a requirement like on click of the column header there should be a call to javascript function which will get other relevant data.
I checked in the api of the column but didn't get anything. How it can be done?
I have one more requirement. The grid should contain data as hyperlink. Which is opening a pop up.
How it can be achieved.
Thanks,
Ketan
-
21 Jan 2010 2:45 AM #2
1. Take a look at the headerclick event for Ext.grid.GridPanel.
2. See the renderer config option for Ext.grid.Column. For example,
PHP Code:function renderLink(value, metaData, record, rowIndex, colIndex, store)
{
return '<a href="http://www.extjs.com" target="_blank">' + value + '</a>';
}
var grid = new Ext.grid.GridPanel({
// ...
columns: [
// ...
{header: 'Link', width: 75, sortable: true, renderer: renderLink, dataIndex: 'link'},
// ...
],
-
21 Jan 2010 4:42 AM #3Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
21 Jan 2010 9:36 PM #4
Hi Team,
Below is my code...
Here the groupclick event is not occurring.Code:var grid = new Ext.grid.GridPanel({ renderTo: 'column-group-grid', title: 'Sales By Location', width: 1000, height: 400, store: new Ext.data.ArrayStore({ fields: fields, data: data, getGroupState: Ext.emptyFn }), columns: columns, //viewConfig: { // forceFit: true //}, view: new Ext.grid.GroupingView({ forceFit:true, showGroupName: true, enableNoGroups:false, enableGroupingMenu:true, hideGroupedColumn: false }), listeners: { rowclick: function(g, index, ev) { alert(index); }, groupclick: function(g, grpField, groupVal, ev) { //var rec = g.store.getAt(index); //userForm.loadRecord(rec); alert("grpField = " + grpField + " groupVal = " + groupVal); }, headerclick: function(g, index, ev) { alert("header index = " + index); } }, plugins: group });
Other 2 events are being fired without any issue.
What is the problem with the 'groupclick'?
Thanks,
Ketan


Reply With Quote
