Results 1 to 2 of 2

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

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    23
    Answers
    1
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    Instead of having the onClick attribute, use event listeners

    Code:
    component.getEl().on({
        click : someFn,
        scope : component,
        delegate : 'a'
    });
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •