1

我的 json 响应就像

Ext.data.JsonP.callback1({"workXml":"{\"Work\":{\"Subjects\":{\"Subject\":[{\"type_lkup\":\"theaters\"},{\"type_lkup\":\"plays\"},{\"type_lkup\":\"actors\"},{\"type_lkup\":\"Te\u0027atron Temuna (Tel-Aviv, Israel)\"},{\"ns0:term\":\"Te\u0027atron Temuna (Tel-Aviv, Israel) \",\"type_lkup\":\"geographicPlace\",\"xmlns:ns0\":\"http://catalog.sharedshelf.artstor.org/ssw\"}],\"Display\":\"Te\u0027atron Temuna (Tel-Aviv, Israel)  ; theaters | plays | actors | Te\u0027atron Temuna (Tel-Aviv, Israel)\",\"xmlns\":\"\"},\"Dates\":{\"Date\":{\"startDate\":2002,\"endDate\":2002},\"Display\":2002,\"xmlns\":\"\"},\"Materials\":{\"Display\":\"Digital Photography  | digital images\",\"Material\":[{\"term_lkup\":\"100 concrete blocks, arranged in a square\"},{\"term_lkup\":\"\\tDigital Photography\"},{\"term_lkup\":\"digital images\"}],\"xmlns\":\"\"},\"ArtstorClassifications\":{\"Classification\":{\"term_lkup\":\"Architecture and City Planning\",\"ssc:id\":\"JPCDPI11C_455778\"},\"xmlns\":\"\"},\"RelatedWorks\":{\"RelatedWork\":{},\"Display\":{},\"xmlns\":\"\"},\"Techniques\":{\"Display\":{},\"Technique\":{\"ssc:id\":\"\"},\"xmlns\":\"\"},\"Descriptions\":{\"Description\":{\"ns0:term\":\"Funded by The Druker Family Judaica Book Fund and The Harvard-Littauer Judaica Endowment in the Harvard College Library. \",\"xmlns:ns0\":\"http://catalog.sharedshelf.artstor.org/ssw\"},\"Display\":\"Funded by The Druker Family Judaica Book Fund and The Harvard-Littauer Judaica Endowment in the Harvard College Library.\",\"xmlns\":\"\"},\"StateEditions\":{\"StateEdition\":{\"ssc:id\":\"\"},\"Display\":{},\"xmlns\":\"\"},\"Agents\":{\"Display\":\"Dagon, Gadi; Veber, Elit; Te\u0027atron Temuna\u0027 (Tel Aviv, Israel)\",\"Agent\":[{\"Source\":{\"term\":127037,\"ssc:id\":\"CREATOR\",\"xmlns\":\"http://catalog.sharedshelf.artstor.org/ssc\",\"SourceDetail\":{\"term\":\"Dagon, Gadi\",\"type_lkup\":\"Personal\"}},\"Date\":{\"earliestDate\":1957,\"xmlns\":\"http://catalog.sharedshelf.artstor.org/ssw\"},\"attribution\":\"\"},{\"Source\":{\"term\":127446,\"ssc:id\":\"ASSOCIATED\",\"xmlns\":\"http://catalog.sharedshelf.artstor.org/ssc\",\"SourceDetail\":{\"term\":\"Veber, Elit\",\"type_lkup\":\"Personal\"}},\"Date\":{\"xmlns\":\"http://catalog.sharedshelf.artstor.org/ssw\"},\"attribution\":\"director\"},{\"Source\":{\"term\":127766,\"ssc:id\":\"ASSOCIATED\",\"xmlns\":\"http://catalog.sharedshelf.artstor.org/ssc\",\"SourceDetail\":{\"term\":\"Te\u0027atron Temuna\u0027 (Tel Aviv, Israel)\",\"type_lkup\":\"Personal\"}},\"Date\":{\"xmlns\":\"http://catalog.sharedshelf.artstor.org/ssw\"},\"attribution\":\"performing artist\"}],\"xmlns\":\"\"},\"Measurements\":{\"Measurement\":{\"ssc:id\":\"\"},\"Display\":{},\"xmlns\":\"\"},\"TextReferences\":{\"Display\":{},\"xmlns\":\"\",\"TextRef\":{\"ssc:id\":\"\"}},\"WorkTypes\":{\"Display\":\"photographs\",\"xmlns\":\"\",\"WorkType\":{\"term_lkup\":\"photographs\"}},\"xmlns:display\":\"http://catalog.sharedshelf.artstor.org/display\",\"xmlns:ssd\":\"http://catalog.sharedshelf.artstor.org/ssd\",\"xmlns:ssc\":\"http://catalog.sharedshelf.artstor.org/ssc\",\"ns0:schemaLocation\":\"http://catalog.sharedshelf.artstor.org/ssw SharedShelfWork.xsd\",\"Inscriptions\":{\"Display\":{},\"xmlns\":\"\",\"Inscription\":{\"position\":\"\",\"ssc:contributor\":\"\",\"Author\":{},\"ssc:id\":\"\"}},\"Rights\":{\"Rights\":{\"ns0:term\":\"Gadi Dagon\",\"xmlns:ns0\":\"http://catalog.sharedshelf.artstor.org/ssw\"},\"Display\":\"Gadi Dagon\",\"xmlns\":\"\"},\"ssc:contributor\":\"HARVARD\",\"Display\":{\"id\":6321442,\"DisplayRecord\":{\"Record\":{\"earliestDate\":{\"content\":2002,\"xmlns\":\"\"},\"latestDate\":{\"content\":2002,\"xmlns\":\"\"},\"location\":{\"xmlns\":\"\"},\"subject\":{\"content\":\"Te\u0027atron Temuna (Tel-Aviv, Israel)  ; theaters | plays | actors | Te\u0027atron Temuna (Tel-Aviv, Israel)\",\"xmlns\":\"\"},\"rights\":{\"content\":\"Gadi Dagon\",\"xmlns\":\"\"},\"workType\":{\"content\":\"photographs\",\"xmlns\":\"\"},\"imageURLOrURN\":{\"content\":\"http://nrs.harvard.edu/urn-3:FHCL:3238354\",\"xmlns\":\"\"},\"date\":{\"content\":2002,\"xmlns\":\"\"},\"sequenceNumber\":{\"content\":1,\"xmlns\":\"\"},\"creator\":{\"content\":\"Dagon, Gadi\",\"xmlns\":\"\"},\"thumbnailURLOrURN\":{\"content\":\"http://nrs.harvard.edu/urn-3:FHCL:3238354\",\"xmlns\":\"\"},\"thumbnailRepositoryID\":{\"content\":\"http://nrs.harvard.edu/urn-3:FHCL:3238354\",\"xmlns\":\"\"},\"title\":{\"content\":\"Eshet | Photographs by Gadi Dagon of show directed by Elit Veber, staged by Te\u0027atron Temuna\u0027 in 2002.\",\"xmlns\":\"\"},\"projectID\":{\"content\":0,\"xmlns\":\"\"},\"description\":{\"content\":\"Funded by The Druker Family Judaica Book Fund and The Harvard-Littauer Judaica Endowment in the Harvard College Library.\",\"xmlns\":\"\"},\"ns0:schemaLocation\":\"http://catalog.sharedshelf.artstor.org/display SSJudaica.xsd\",\"imageRepository\":{\"content\":\"Judaica\",\"xmlns\":\"\"},\"oLIVIAID\":{\"content\":\"W455778_1\",\"xmlns\":\"\"},\"materialsOrTechniques\":{\"content\":\"Digital Photography  | digital images\",\"xmlns\":\"\"},\"captionnote\":{\"xmlns\":\"\"},\"xmlns\":\"http://catalog.sharedshelf.artstor.org/display\",\"associatedname\":{\"content\":\"Veber, Elit | Te\u0027atron Temuna\u0027 (Tel Aviv, Israel)\",\"xmlns\":\"\"},\"classification\":{\"content\":\"JPCDPI11C_455778\",\"xmlns\":\"\"},\"imageRepositoryID\":{\"content\":14062675,\"xmlns\":\"\"},\"culture\":{\"content\":\"Israeli\",\"xmlns\":\"\"}},\"xmlns\":\"\"},\"xmlns\":\"http://catalog.sharedshelf.artstor.org/ssd\"},\"Locations\":{\"Repository\":{\"ns0:term\":\"Judaica\",\"xmlns:ns0\":\"http://catalog.sharedshelf.artstor.org/ssw\"},\"PrivateOwner\":{\"ns0:term\":\"FHCL.JUD\",\"xmlns:ns0\":\"http://catalog.sharedshelf.artstor.org/ssw\"},\"Display\":\"Te\u0027atron Temuna (Tel-Aviv, Israel)\",\"Location\":{\"Source\":{\"term\":\"OLIVIA\",\"xmlns\":\"http://catalog.sharedshelf.artstor.org/ssc\"},\"ssc:vocab\":\"performing arts centers\",\"location\":\"Te\u0027atron Temuna (Tel-Aviv, Israel)\",\"type_lkup\":\"subject\",\"ssc:id\":62220},\"xmlns\":\"\"},\"xmlns\":\"http://catalog.sharedshelf.artstor.org/ssw\",\"Notes\":{\"Display\":{},\"Note\":[{\"ns0:term\":\"Gadi Dagon\",\"type_lkup\":\"Copyright\",\"xmlns:ns0\":\"http://catalog.sharedshelf.artstor.org/ssw\"},{\"ns0:term\":\"Funded by The Druker Family Judaica Book Fund and The Harvard-Littauer Judaica Endowment in the Harvard College Library.\",\"type_lkup\":\"General\",\"xmlns:ns0\":\"http://catalog.sharedshelf.artstor.org/ssw\"},{\"ns0:term\":\"digital images\",\"type_lkup\":\"Materials and Techniques\",\"xmlns:ns0\":\"http://catalog.sharedshelf.artstor.org/ssw\"}],\"xmlns\":\"\"},\"StylePeriods\":{\"StylePeriod\":{\"ssc:id\":\"\"},\"Display\":{},\"xmlns\":\"\"},\"ssc:refid\":455778,\"Cultures\":{\"Culture\":{\"term_lkup\":\"Israeli\"},\"Display\":\"Israeli\",\"xmlns\":\"\"},\"Titles\":{\"Display\":\"Eshet | Photographs by Gadi Dagon of show directed by Elit Veber, staged by Te\u0027atron Temuna\u0027 in 2002.\",\"xmlns\":\"\",\"Title\":[{\"ns1:term\":\"Eshet\",\"ssc:pref\":true,\"xmlns:ns1\":\"http://catalog.sharedshelf.artstor.org/ssw\"},{\"ns0:term\":\"Photographs by Gadi Dagon of show directed by Elit Veber, staged by Te\u0027atron Temuna\u0027 in 2002.\",\"xmlns:ns0\":\"http://catalog.sharedshelf.artstor.org/ssw\"}]},\"xmlns:ns0\":\"http://www.w3.org/2001/XMLSchema-instance\"}}","legacyId":455778,"workIndexId":"f4ff82dc-7622-407b-81b8-072a9698dbb0","contributor":"olivia"});

我的阅读器功能是

Ext.define('MyReader', {  
extend: 'Ext.data.reader.Json',
  alias: 'reader.my-json',
  read: function(object) {
    object.workXml = Ext.decode(object.responseText);
    return this.callParent([object]);
  }
});

我的商店是

Ext.define('WR.store.WorkRecord', {
extend : 'Ext.data.Store',
model : 'WR.model.WorkRecord',
autoLoad: true,

proxy: {
    type: 'jsonp',
    api: {
        read: 'http://192.168.90.188:8282/service/work/json/getWorkXmlByCompositeKey?compositeKey=455778-OLIVIA&authToken=123',
        update: 'data/updateUsers.json'
      },
    reader: {
        type: 'my-json',
        root: 'workXml',
        successProperty: 'success'
    }
}

});

但是我的阅读器函数返回一个空对象。当我 console.log(object.workXml) 时,它说未定义,当我 console.log(object) 时,它没有任何 resposeText。所以我不知道如何解码响应。是否需要使用回调方法?如果是这样,请帮助如何编写它。实际上我想解码这个 json 字符串并将其映射到我的模型,以便我可以轻松使用它。我的模型是

Ext.define('WR.model.WorkRecord', {
extend: 'Ext.data.Model',
fields: ['name',
         {name:'ns1term',mapping:'Work.Titles.Title[0]["ns1:term"]'},
         {name:'ns0term',mapping:'Work.Titles.Title[1]["ns0:term"]'},
         {name:'agent_display',mapping:'Work.Agents.Display'},
         {name:'cultures_display',mapping:'Work.Cultures.Display'},
         {name:'locations_display',mapping:'Work.Locations.Display'},
         {name:'dates_display',mapping:'Work.Dates.Display'},
         {name:'worktypes_display',mapping:'Work.WorkTypes.Display'},
         {name:'materials_display',mapping:'Work.Materials.Display'},
         {name:'techniques_display',mapping:'Work.Techniques.Display'},
         {name:'measurements_display',mapping:'Work.Measurements.Display'},
         {name:'subjects_display',mapping:'Work.Subjects.Display'},
         {name:'descriptions_display',mapping:'Work.Descriptions.Display'},
         {name:'notes_display',mapping:'Work.Notes.Display'}]      

});
4

0 回答 0