Hello Support:
I'm having conceptual difficulties with how to encapsulate a fetch(). Consider the following:
var getAllProjects = function() {
projectsDataSource.fetch(function() {
var dataView = projectsDataSource.view();
return dataView;
});
};
where projectsDataSource is a Kendo dataSource defined with a remote source. I should say that the inner portion above works flawlessly (by inner portion I mean the part defined as projectsDataSource.fetch(function() { ...}).
However, I decided to encapsulate this functionality in a separate module defined by RequireJS, leading naively to the code above where I declare getAllProjects().
I'm trying to return dataView to the outer function, getAllProjects(), a function that is revealed publicly. All I get back, though, is undefined. It would seem that you're using callbacks, not promises, which appears to be confusing me.
What am I missing here?
Thank you.
I'm having conceptual difficulties with how to encapsulate a fetch(). Consider the following:
var getAllProjects = function() {
projectsDataSource.fetch(function() {
var dataView = projectsDataSource.view();
return dataView;
});
};
where projectsDataSource is a Kendo dataSource defined with a remote source. I should say that the inner portion above works flawlessly (by inner portion I mean the part defined as projectsDataSource.fetch(function() { ...}).
However, I decided to encapsulate this functionality in a separate module defined by RequireJS, leading naively to the code above where I declare getAllProjects().
I'm trying to return dataView to the outer function, getAllProjects(), a function that is revealed publicly. All I get back, though, is undefined. It would seem that you're using callbacks, not promises, which appears to be confusing me.
What am I missing here?
Thank you.