Javascript 在html属性中调用函数时,无法在sencha touch中获取父引用

Javascript 在html属性中调用函数时,无法在sencha touch中获取父引用,javascript,html,extjs,sencha-touch,Javascript,Html,Extjs,Sencha Touch,我需要在sencha touch的控制器中制定一个通用方法,以便应用程序中的其他类似模块能够获取这些代码。但现在我陷入了困境,因为我找不到它的解决方案(即使在谷歌上尝试了100次)。问题是调用函数位于“html”属性中,现在我们需要它的父引用,以便可以引用它的所有其他同级,请查看下面的代码: <Ext.form.IFieldSet>{ // THIS SHOWS ONLY if there is existing data under "other income"

我需要在sencha touch的控制器中制定一个通用方法,以便应用程序中的其他类似模块能够获取这些代码。但现在我陷入了困境,因为我找不到它的解决方案(即使在谷歌上尝试了100次)。问题是调用函数位于“html”属性中,现在我们需要它的父引用,以便可以引用它的所有其他同级,请查看下面的代码:

<Ext.form.IFieldSet>{   //  THIS SHOWS ONLY if there is existing data under "other income"
                    xtype: 'fieldset',
                    title: 'Other Income',
                    itemId: 'OtherIncomeFirstSet',
                    //instructions: '<hr class="separate" />',
                    items: [
                        <Ext.field.ISelect>{
                            xtype: 'selectfield',
                            name: 'BorrowerPositionFirstSet',
                            label: 'Borrower Position',
                            store: 'BorrowerPositionSelectorStore',
                            //usePicker: false,
                            disabled: true,
                        },
                        <Ext.field.ISelect> {
                            xtype: 'selectfield',
                            name: 'IncomeTypeFirstSet',
                            label: 'Income Type',
                            store: 'IncomeTypeSelectorStore',
                            //usePicker: false,
                            disabled: true,
                        },
                        {
                            xtype: 'textfield',
                            name: 'DescriptionFirstSet',
                            label: 'Description',
                            disabled: true,
                        },
                        {
                            xtype: 'numberfield',
                            name: 'MonthlyAmountFirstSet',
                            label: 'Monthly Amount',
                            disabled: true,
                        },
                        <Ext.form.IField>{
                            xtype: 'field',
                            label: ' ',
                            //this is the html attribute I am talking about...
                            html: '<a href="#" onclick="event.preventDefault();App.app.getController(\'lead.leadsListController\').onClickDelete(this)" class="ta-textlink deleteLink">Delete</a><a href="#" onclick="event.preventDefault();App.app.getController(\'lead.leadsListController\').onClickEdit(this)" class="ta-textlink editLink">Edit</a>'
                        }
                    ]

你可以看到这简直是胡说八道!请sencha开发者帮我找到解决方案。如何通过其子项获取引用项目ID:“OtherIncomeFirstSet”

为什么不为此使用一个(或两个)按钮。听起来有点像CSS,这个按钮就可以了。此外,您还可以在控制器中使用它。字段集并不意味着不能使用按钮

提示:永远不要尝试从外部调用控制器

如果您真的需要使用字段和单击事件,请使用以下代码(别忘了,这不是我的首选,因为这可以在ST中用两个按钮很好地编写,真的!!!!):

{
xtype:'字段',
标签:“”,
//这就是我所说的html属性。。。
html:'+
''
}
以及控制器内部

config: {
    refs: {
        myView: '.myView', //Whatever the basic view is you created
        form: '.myview .form'
    },
    control: {
        form: {
            delete: 'onDelete',  // <<<< here you listen to the event
            edit: 'onEdit'
        }
    }
},

onDelete: function() {},
onEdit: function() {}
config:{
参考文献:{
myView:'.myView',//无论您创建的基本视图是什么
表单:'.myview.form'
},
控制:{
表格:{

删除:'onDelete',//按照您的方式工作,我知道它会像我以前使用的按钮一样工作……好吧,不管怎样,谢谢您的回答。刚刚回答了这个问题,对您来说,哪一个可能是更好的解决方案:
<Ext.form.IField>{
    xtype: 'field',
    label: ' ',
    //this is the html attribute I am talking about...
    html: '<a href="#" onclick="event.preventDefault(); ' +
        'Ext.Viewport.down('.form').fireEvent('delete') ' + // <<<< Here fire the event
        'class="ta-textlink deleteLink">' +
            'Delete' +
        '</a>' +
        '<a href="#" onclick="event.preventDefault(); ' +
        'Ext.Viewport.down('.form').fireEvent('edit') ' +  // <<<<< And here
        'class="ta-textlink editLink">' +
            'Edit' +
        '</a>'
}
config: {
    refs: {
        myView: '.myView', //Whatever the basic view is you created
        form: '.myview .form'
    },
    control: {
        form: {
            delete: 'onDelete',  // <<<< here you listen to the event
            edit: 'onEdit'
        }
    }
},

onDelete: function() {},
onEdit: function() {}