PDA

View Full Version : [INFOREQ] Creating a store with inline data requires a proxy



nightwatch
28 Oct 2011, 12:24 AM
Creating a Json data store with inline data fails if proxy is not specified:

ttasx.store = Ext.create('Ext.data.Store', {
model: 'Task',
sorters: 'createdDate',

data: [
{ id: '1342', title: 'Uzupełnij dane klienta nr 389', createdDate: '2011-05-13 10:33:00', status: 'Open', category: 'Testing', addFields: "msisdn: 481234234233, lokalizacja: Łódź" },
{ id: '1352', title: 'Popraw conieco', createdDate: '2011-05-15 20:41:00', status: 'Open', category: 'Testing', addFields: "msisdn: '481234234233', nr_fakt: '3992932'" },
{ id: '1353', title: 'Zaakceptuj wniosek o VPN', createdDate: '2011-05-16 10:41:00', status: 'Open', category: 'Wnioski/VPN', addFields: "user: 'Tomasz AB', telefon: '0230233'" },
{ id: '1354', title: 'Zaakceptuj wniosek o VPN', createdDate: '2011-05-17 11:11:00', status: 'Open', category: 'Wnioski/VPN', addFields: "user: 'Tomasz X', telefon: '0230233'" },
{ id: '1355', title: 'Wezwanie do zapłaty nr VF/8392/83920', createdDate: '2011-05-20 23:41:00', status: 'Open', category: 'WDZ/Wezwanie', addFields: "nr_fakt: '3992932'" },
{ id: '1355', title: 'Wezwanie do zapłaty nr VF/8392/90039', createdDate: '2011-05-20 23:43:00', status: 'Open', category: 'WDZ/Wezwanie', addFields: "nr_fakt: '3992112'" },
{ id: '1356', title: 'Weryfikacja ummowy nr UM01-9329389', createdDate: '2011-05-25 20:41:00', status: 'Open', category: 'Weryfikacja umów', addFields: "msisdn: '481234234233'" }
]

});

Error: Uncaught TypeError: Expecting a function in instanceof check, but got [object Object]Ext.define.constructor/nginntasks/Content/touch/src/data/Store.js:421
Ext.apply.create.Classsencha-touch-debug.js:4917
(anonymous function)
Ext.ClassManager.instantiatesencha-touch-debug.js:6137
(anonymous function)sencha-touch-debug.js:3130
(anonymous function)

If I specify a proxy, it works:


ttasx.store = Ext.create('Ext.data.Store', {
model: 'Task',
sorters: 'createdDate',
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'droot'
}
},
data: { droot: [
{ id: '1342', title: 'Uzupełnij dane klienta nr 389', createdDate: '2011-05-13 10:33:00', status: 'Open', category: 'Testing', addFields: "msisdn: 481234234233, lokalizacja: Łódź" },
{ id: '1352', title: 'Popraw conieco', createdDate: '2011-05-15 20:41:00', status: 'Open', category: 'Testing', addFields: "msisdn: '481234234233', nr_fakt: '3992932'" },
{ id: '1353', title: 'Zaakceptuj wniosek o VPN', createdDate: '2011-05-16 10:41:00', status: 'Open', category: 'Wnioski/VPN', addFields: "user: 'Tomasz AB', telefon: '0230233'" },
{ id: '1354', title: 'Zaakceptuj wniosek o VPN', createdDate: '2011-05-17 11:11:00', status: 'Open', category: 'Wnioski/VPN', addFields: "user: 'Tomasz X', telefon: '0230233'" },
{ id: '1355', title: 'Wezwanie do zapłaty nr VF/8392/83920', createdDate: '2011-05-20 23:41:00', status: 'Open', category: 'WDZ/Wezwanie', addFields: "nr_fakt: '3992932'" },
{ id: '1355', title: 'Wezwanie do zapłaty nr VF/8392/90039', createdDate: '2011-05-20 23:43:00', status: 'Open', category: 'WDZ/Wezwanie', addFields: "nr_fakt: '3992112'" },
{ id: '1356', title: 'Weryfikacja ummowy nr UM01-9329389', createdDate: '2011-05-25 20:41:00', status: 'Open', category: 'Weryfikacja umów', addFields: "msisdn: '481234234233'" }
]
}
});

Jamie Avins
31 Oct 2011, 12:17 PM
Did that work untouched in 1.x?