1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    23
    Vote Rating
    0
    Answers
    1
    shwetapro is on a distinguished road

      0  

    Default Unanswered: How to pass class reference in a hyperlink cell data of a tree panel ExtJS4

    Unanswered: How to pass class reference in a hyperlink cell data of a tree panel ExtJS4


    Hi,
    I have a tree panel. It has a column that has a delete hyperlink for all the rows as shown below:

    planName: someName,
    deleteLink: '<a href="#" onclick="planRef.callClickMe();">Delete</a>'


    where "deleteLink" is a dataindex in the tree panel as shown below:

    Ext.define('PanelJS', {
    extend: 'Ext.tree.Panel',
    columns: [
    {
    xtype: 'treecolumn',
    dataIndex: 'planName',
    flex: 2
    },
    {
    dataIndex: 'deleteLink',
    tdCls: 'custom-column',
    flex: 1
    }]
    }


    But console says "planRef" is undefined when it is declared on class level, moreover I have checked the value of "planRef" before this line.

    During debug mode when "planRef.callClickMe()" is watched it gives proper value. But at runtime, when screen is loaded and I click on the "Delete" link console says "planRef" is undefined.

    I have even tried href config of NodeInterface but it does not show any hyperlink text.

    I'm badly stuck into this issue. Help appreciated.

    Thanks in advance,
    Shweta

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,107
    Vote Rating
    453
    Answers
    3155
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Instead of having the onClick attribute, use event listeners

    Code:
    component.getEl().on({
        click : someFn,
        scope : component,
        delegate : 'a'
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.