i doing unit testing , add dummy data existing store. in function testing, calling store:
var tripstore = ext.getstore('trips'); normally, store have been populated ajax call @ previous point. however, since testing want use dummy data , not rely on end. realize rewrite function pass in store, not want rewrite sake of testing.
bottom line, how add local data store exists has no data in it? furthermore, end not available, when try store.load or store.reload throws 404 saying cannot find url rest/trip. don't want try , call url, instead want add local data.
the model definition:
ext.define('app.model.trip', { fields:[ {name: 'somefield1', type: 'string'}, {name: 'somefield2', type: 'string'}, {name: 'somefield3', type: 'string'}, ], proxy: { nocache: true, url: 'rest/trip', reader: { type: 'json', rootproperty: 'trips' } } }); the (attempted) test script calling url when don't want to, want add local data:
var tripsstore = ext.storemanager.lookup('trips'); tripsstore.load({ autoload: false, addrecords: true, proxy: { data: localdata, }, callback: function(records, operation, success) { if (success) { debugger } else { debugger } } })
use ajax.simmanager. see example (open details on right-hand side, click on of data tabs).
Comments
Post a Comment