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) の場合、undefined と表示され、console.log(object) の場合、resposeText がありません。これをデコードする方法がわかりません。 response.コールバック メソッドを使用する必要はありますか? もしそうなら、それを書く方法を助けてください。実際には、この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