0
如何在調用ExtJS中的保存命令之前格式化輸入數據ExtJS如何格式化輸入數據的保存方法
下面是組的模型。對於添加新組,用戶可以選擇輸入dn或dn_query。
如果用戶希望有DN那麼REST API需要有
以下數據格式:
** {
"id": "f4287ae0",
"dn": "dc=example,dc=com",
"label" : 'lable1'
}
但是如果用戶想進入dn_query那麼REST API需要有下面的數據格式:
** {
"id": "f4287ae0",
"dn_query": {
"domain": "dc=example",
"query": "account=account1"
}
"label" : 'label'
}
如何更改模型,以便它可以處理機器人的數據格式>
// This is model
Ext.define('Console.model.Group', {
extend: 'Ext.data.Model',
fields: [{
name: 'id',
type: 'string'
}, {
name : 'label',
type : 'string',
} , {
name: 'dn',
type: 'string'
}, {
name: 'dn-query',
type: 'string',
}],
proxy: {
simpleSortMode: true,
type: 'rest',
url: '/api/group',
reader: {
type: 'json',
root: 'data',
totalProperty: 'total'
}
}
});
var app = Console.model.Group.create(values);
var f = this;
app.save({
.....
})
感謝您的幫助。
非常感謝回答我的問題 - 我會嘗試改變模式,你建議和測試Add方法 – kim2014
我對GET方法的另一個問題。你可以看看你是否有解決我的問題 – kim2014