0
我有以下json數據現在我想創建一個基於這個儀式的記錄現在我有以下結構來創建記錄,但我不知道如何將CONTACT_INFO作爲嵌套元素爲嵌套的json元素創建記錄
注:我直接從GRID讀取值(但網格我沒有得到嵌套元素CONTACT_INFO然後要創建記錄)
RECORD
var record= Ext.data.Record.create([
{ name: 'CANDI_SR_NO'},
{ name: 'CANDI_NAME'},
{ name: 'CANDI_CASTE_BAR'},
{ name: 'CANDI_IS_NRI'},
{ name: 'CANDI_CASTE'},
{ name: 'CANDI_SUB_CASTE'},
{ name: 'CANDI_STATUS'},
{ name: 'CANDI_AGE'},
{ name: 'CANDI_HEIGHT'},
{ name: 'CANDI_NATIVE_PLACE'},
{ name: 'CANDI_EDUCATION'},
{ name: 'CANDI_DESIGNATION'},
{ name: 'CANDI_COMPANY'},
{ name: 'CANDI_EMAIL_1'},
{ name: 'CANDI_EMAIL_2'},
{ name: 'CANDI_EMAIL_3'},
{ name: 'CON_L_1'},
{ name: 'CON_L_2'},
{ name: 'CON_L_3'},
{ name: 'CON_M_1'},
{ name: 'CON_M_2'},
{ name: 'CON_M_3'},
{ name: 'CANDI_SALARY'},
{ name: 'CANDI_COMMENT'},
]);
JSON
[
{
"CANDI_SR_NO": "12",
"CANDI_NAME": "XYZ",
"CANDI_CASTE_BAR": false,
"CANDI_IS_NRI": "false",
"CANDI_CASTE": "RAS",
"CANDI_SUB_CASTE": "",
"CANDI_STATUS": "",
"CANDI_AGE": "",
"CANDI_NATIVE_PLACE": "",
"CANDI_EDUCATION": "",
"CANDI_DESIGNATION": "",
"CANDI_COMPANY": "",
"CONTACT_INFO":
{
"CANDI_EMAIL_1": "asdf",
"CANDI_EMAIL_2": "",
"CANDI_EMAIL_3": "",
"CON_L_1": "asdf",
"CON_L_2": "",
"CON_L_3": "",
"CON_M_1": "",
"CON_M_2": "",
"CON_M_3": ""
}
,
"CANDI_SALARY": "",
"CANDI_COMMENT": ""
}
]
我想給在如上一個JSON格式的數據,但一旦我點擊提交表單的按鈕。所以我問如何在extjs中創建一個記錄,以便我可以在json內部發送嵌套元素
嗯,我想這個映射是從JSON接收數據,我想發送一個嵌套字段的JSON – Hunt 2011-04-27 11:21:39
那麼你有任何例子,像我在哪裏可以找到如何重寫jsonWriter的哈希函數 – Hunt 2011-04-27 13:56:25
在我的答案我給了通過製作JsonWriter的子類來覆蓋它。然後,您將爲您的作者使用「CandiWriter」實例,而不是「JsonWriter」之一。 – wombleton 2011-04-27 14:13:40