Extjs 使用Sencha touch 2.3中的控制器提交Sencha表单

Extjs 使用Sencha touch 2.3中的控制器提交Sencha表单,extjs,sencha-touch,sencha-touch-2,Extjs,Sencha Touch,Sencha Touch 2,我有一份sencha申请,我正在提交一份表格。 我在SubmitButton选项卡事件中添加了一个监听器,并使用ajax提交了表单 我现在只想使用控制器提交表单。我如何继续?您可以: Ext.define('Myapp.view.Form', { extend: 'Ext.form.FormPanel', xtype: 'my-form', config: { items: [ { xtype: '

我有一份sencha申请,我正在提交一份表格。 我在SubmitButton选项卡事件中添加了一个监听器,并使用ajax提交了表单

我现在只想使用控制器提交表单。我如何继续?

您可以:

Ext.define('Myapp.view.Form', {
    extend: 'Ext.form.FormPanel',
    xtype: 'my-form',

    config: {
        items: [
            {
                xtype: 'textfield'
                name: 'field1'
            }, {
                xtype: 'textfield',
                name: 'field2'
            }, {
                xtype: 'button',
                text: 'submit',
                handler: function() {
                    var form = this.getParent();
                    var values = form.getValues();
                    form.fireEvent('submitForm', values);
                }
        ]
};


希望有帮助-

你可以这样做-

视图:

控制器:

Ext.define('Myapp.controller.Main', {
    extend: 'Ext.app.Controller',

    config: {
        refs: {
            myForm : 'my-form',
            btnFormSubmit: 'my-form button[action=submitForm]'
        },

        control: {
            btnFormSubmit: {
                tap: 'onBtnFormSubmitTap'
            }
        }
    }, 

    onBtnFormSubmitTap: function() {
        var myForm = this.getMyForm();
        var values = myForm.getValues();
        myForm.Submit();
        console.log(values);
    }
};
您可以找到有关提交方法的更多帮助,以查看
myForm.submit()
选项:

谢谢@Niclolas的帮助。我一定会试试这个,然后告诉你
Ext.define('Myapp.view.Form', {
    extend: 'Ext.form.FormPanel',
    xtype: 'my-form',

    config: {
        items: [
            {
                xtype: 'textfield'
                name: 'field1'
            }, {
                xtype: 'textfield',
                name: 'field2'
            }, {
                xtype: 'button',
                text: 'submit',
                action: 'submitForm'
        ]
};
Ext.define('Myapp.controller.Main', {
    extend: 'Ext.app.Controller',

    config: {
        refs: {
            myForm : 'my-form',
            btnFormSubmit: 'my-form button[action=submitForm]'
        },

        control: {
            btnFormSubmit: {
                tap: 'onBtnFormSubmitTap'
            }
        }
    }, 

    onBtnFormSubmitTap: function() {
        var myForm = this.getMyForm();
        var values = myForm.getValues();
        myForm.Submit();
        console.log(values);
    }
};