This is strangest thing, i ever came across. In Sencha Touch i define a new class and some methods in it. Now the problem is with the getAll
method
i want to return the result in then
fuction but it is not returning
that results
when i console
it, it shows the result. What seems to be the issue, I think its private function but how do i make it public.
When i create new instance of the pouch, It does not return the results i desired
Ext.define('Inertia.view.Pouch', {
config:{
database: 'Sencha',
db: false,
result: false,
},
constructor : function(config) {
if(config){
this.setDatabase(config);
}
this.setDb(//);
this.initConfig(config);
},
// get All results
getAll: function(){
var me = this;
me.data = 'NO Record found';
var res = me.getDb().allDocs({
include_docs: true,
attachments: true
}).then(function (result) {
**// I want this return to be returned when i call getAll()**
me.data = result;
// i even tried this
return result;// but its also not working
}).catch(function (err) {
console.log(err);
});
return me.data;
}
});
and when i do this
var p = new Ext.create('test.view.Pouch', 'sencha');
var data = p.getAll();
it shows the
'NO Record found';