1. #1
    Ext User
    Join Date
    Jan 2010
    Posts
    2
    Vote Rating
    0
    ketanmulay is on a distinguished road

      0  

    Default 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

  2. #2
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750
    Vote Rating
    9
    fay will become famous soon enough fay will become famous soon enough

      0  

    Default


    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(valuemetaDatarecordrowIndexcolIndexstore
    {
      return 
    '<a href="http://www.extjs.com" target="_blank">' value '</a>';
    }

    var 
    grid = new Ext.grid.GridPanel({
    // ...
      
    columns: [
      
    // ...
        
    {header'Link'width75sortabletruerendererrenderLinkdataIndex'link'},
      
    // ...
      
    ], 

  3. #3
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Quote Originally Posted by ketanmulay View Post
    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
    When looking at the API, try to read through the events before giving up

  4. #4
    Ext User
    Join Date
    Jan 2010
    Posts
    2
    Vote Rating
    0
    ketanmulay is on a distinguished road

      0  

    Default


    Hi Team,

    Below is my code...

    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
        });
    Here the groupclick event is not occurring.
    Other 2 events are being fired without any issue.

    What is the problem with the 'groupclick'?

    Thanks,
    Ketan

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi