javascript - Loading data into model by id-Extjs -
im trying use direct store in extjs
heres code store
ext.define('ide.store.files', { extend: 'ext.data.store', proxy: { type: 'direct', api: { create:files.addnew, read:files.getfile, update:files.update, destroy:files.delete, //load:files.getfile }, paramorder:'path' }, model:'ide.model.file' })
the code model
ext.define('ide.model.file', { extend: 'ext.data.model', fields: [ { name: 'path', type: 'string' }, { name: 'name', type: 'string' }, { name: 'extention', type: 'string' }, { name: 'content', type: 'string' } ], idproperty:'path', store:'ide.store.files' })
as can see idproperty
path
following code segment giving error
//this.getstore('ide.store.files').load(path, { sucess: function (file) { // console.log(file.get('content')); // } }); this.getstore('ide.store.files').load(path);
here im getting path
somewhere , trying load file particular path error is
ext.data.proxy.direct.dorequest(): no direct function specified proxy
now problem documentation of extjs isnt enough , everywhere searched see 4 api in api
object of proxy
.
1.create
2.read
3.update
4.destroy
api missing ? or
need give direct function load()
there multiple problems figure out code putting here of community.
1. way calling load function correct.. , doest takes parameter whole object scope , callback mayb error saying http://docs.sencha.com/ext-js/4-0/#!/api/ext.data.store-method-load
2. if remove api
.. , use directfn
config option appears work..
code:
ext.define('ide.store.files', { extend: 'ext.data.store', proxy: { type: 'direct', directfn: files.getfile, // <--- new line of code api: { create:files.addnew, //read:files.getfile, // <--- old line of code update:files.update, destroy:files.delete }, paramorder:'path' }, model:'ide.model.file' })
Comments
Post a Comment