extdirectspringを使用して、Spring MVC アプリの ext direct をセットアップしました。プリミティブと文字列を取得して、ext.js で使用できます。オブジェクトのリストを取得しようとすると、JavaScript 側で「未定義」になります。Person クラスを機能させるために何か特別なことをする必要がありますか?
次のコードに注釈を付けました。
@ExtDirectMethod(ExtDirectMethodType.STORE_READ)
@Override
public Collection<Person> getPeople(String groupId) {
Group group = GroupManager.getGroup(groupId);
return group.getPeopleList();
}
これは私がクライアント側で使用しているものです:
directory.getPeople(id, function(result) {
console.log(result);
});
app.js は次のようになります。
Ext.ns('Ext.app');
Ext.app.REMOTING_API = {
"actions":{
"directory":[{
"name":"getID","len":0
},{
"name":"getPeople","len":1
}
]},
"type":"remoting",
"url":"/test/action/router"
};