1

にボタンを追加しましたView

{
     xtype:'button',
     id:'when_button_click',
     text:'Button Click',
     ui:'alert'
}

コントローラーには、次のコードがあります。

1.)私が抱えている問題は、関数Ext.Ajax.request({の行以降では実行されないことです。onNewNoteプログラムにそのURLにデータを送信させるにはどうすればよいですか。

2.)にはView、いくつかtextfieldsあります。したがって、ユーザーがをタップすると、buttonに入力された値textfieldsControllerクラスに送信してから、Webサービスを介して送信する必要があります。ViewクラスからControllerクラスにテキストフィールドデータを送信するにはどうすればよいですか?

Ext.define('myapp.controller.testcont', {

                      extend: "Ext.app.Controller",
                      config: {
                      refs: {
                      newNoteBtn: "#when_button_click"
                      },
                      control: {
                      newNoteBtn: {
                      tap: "onNewNote"
                      }
                      }
                      },
                      onNewNote: function () {

                     console.log("inside onNewNote function");

           Ext.Ajax.request({
                            url: 'http://call.com/the_webservice',
                            params : values,

                            failure: function (response) {
                            var text = response.responseText;
                             console.log("fail");

                            },                              success: function (response) {
                            var text = response.responseText;
                             console.log("success");

                            }

                            });

           var view = Ext.create('Ext.navigation.View', {
                                 fullscreen: true,
                                 items: [
                                         {
                                         title: 'Navigation View',
                                         html: 'This is the first item in the stack!'
                                         }
                                         ]
                                 });

                      }

                      // init and launch functions omitted.
                      });
4

1 に答える 1

0

通常、複数のフォーム フィールドを定義する場合は、FormPanel最初にそれらをコンポーネントでラップし、たとえば を設定しidてから、id: 'form'コントローラーでを設定する必要があります。

Ext.getCmp('form').getValues();

フォーム パネルの各フィールドの値を含むオブジェクトを返します。

于 2012-05-06T09:29:36.367 に答える