2011-12-23 12 views
0

私はextjsとPlayデータバインディングを使いたいと思います。 は、私はこのようなExtJSの持つデータストアを作成しました:ExtJSとPlay!フレームワーク

Ext.define('Account', { 
    extend : 'Ext.data.Model', 
    fields : [{ 
     name : 'description', type: 'string' 
    }, { 
     name : 'accountNumber', type: 'string' 
    }] 
}); 

store = Ext.create('Ext.data.Store', { 
    model: 'Account', 
    proxy: { 
      type: 'ajax', 
      autoSave: false, 
      api: { 
       read: 'account/research', 
       create: 'account/new', 
       update: 'account/update', 
       destroy: 'account/delete' 
      }, 
      reader: { 
       type: 'json' 
      }, 
      writer: { 
       type: 'json', 
       writeAllFields: true, 
       encode: false 
      } 
    } 
}); 

私はこれを行う場合:

var compte = Ext.create('Account', { 
    description: 'test' 
}); 
store.create(0, compte); 

が、私のコントローラで:

public static void new(Account account) { 
    account.save(); 
    renderJSON("{success: true}"); 
} 

をすべてのフィールドがnullです。 私は、おかげで

答えて

0

申し訳ありませんが、私はあなたがする必要がある(非常に類似している)のプレイに慣れてなく、Grailsのではないですフィールドは私のPOSTリクエスト

でaccount.descriptionとaccount.accountNumberなどの接頭辞を持っている必要がありますので、それはだと思いますDomainオブジェクトに対してsave()を呼び出す前に、少しデータバインディングを行います。この

Account account = new Accouunt(params) 

または

Account account = new Account() 
account.properties = params 

EDITのように:いくつかの遊びのドキュメントを駆け抜けたと私は、サーバー側で正しくそれをやっていると思います。クライアント側では、 "nameProperty"設定を使用して試すことができます。 Playの予想される名前に合致するプロパティを定義し、namePropertyに使用する必要があります。

関連する問題