Hi,
My JET Version is 5.1.0
I have a table based on search and it is working fine .
I have a few lines of code used to construct the table based on a service.
My issue is i want to find out the length of an ko.observable(self.datasource) but it gives me zero or Undefined as highlighted below
$(document).ready(function () {
self.docSeqMethod();
});
self.ready=ko.observable(false);
self.datasource = ko.observable();
self.docSeqMethod = function(){
var deptArray=[];
self.datasource(new oj.ArrayTableDataSource(deptArray,{ idAttribute: 'seq_id'}));
self.pagingDatasourcedocseq =new oj.PagingTableDataSource(self.datasource());
self.ready(false);
var aa = 'http://192.168.1.160:8080/apex/jetapps/admin/documentsequence');
console.log("aa data");
var loginCollection = new oj.Collection.extend({
url: aa,
model: new oj.Model.extend({
idAttribute: 'seq_id',
parse: parseMethoddocseq
}),
});
new loginCollection().fetch({
success: function (response) {
console.log(response.toJSON());
res=response.toJSON();
console.log("response------"+res);
self.datasource(new oj.ArrayTableDataSource(res,{idAttribute: 'seq_id'}));
//Though my application works fine i just want to find the length of the datasource observable
console.log("self.()length------"+self.datasource().length);// i am getting undefined here
console.log("self length------"+self.datasource.length);//i am getting 0 here
self.pagingDatasourcedocseq = new oj.PagingTableDataSource(self.datasource());
console.log("ds"+self.datasource);
self.deptArray=res;
console.log("deptarray------"+deptArray);
self.ready(true);
},
error: function (jqXHR, textStatus, errorThrown) {
console.log('Error in fetch: ' + textStatus);
}
});
};
Thanks in Advance