Reputation: 404
To facilitate a JsonRest store with a non-standard url scheme, I am trying to inherit JsonRest and override the _getTarget(id)
function. Here is what my inherited javascript class looks like:
define([
"dojo/_base/declare",
"dojo/store/JsonRest",
],
function(declare, JsonRest) {
return declare(JsonRest, {
_getTarget: function(id){
var target = this.target;
if(typeof id != "undefined"){
if(target.indexOf("{id}") != -1) {
//use template
target = target.replace("{id}", id);
} else {
target = this.inherited(id);
}
}
return target;
},
});
});
However the line target = this.inherited(id);
returns an error: Uncaught TypeError: Cannot read property 'callee' of undefined
.
I looked at the docs, and I think I am doing it right: http://dojotoolkit.org/reference-guide/1.10/dojo/_base/declare.html#calling-superclass-methods
What is the proper way to call the base class's _getTarget(id)
function?
Upvotes: 1
Views: 936
Reputation: 10559
If you look closely the part of the documentation you linked, you are supposed to literally pass the arguments
object to this.inherited
- that's what contains the callee
property it is looking for (and will include the id
and any other arguments anyway, to be passed along to the superclass).
A few paragraphs in, the documentation also explains how to call this.inherited
with arguments other than the same ones passed, if necessary: you can pass custom arguments in an array after arguments
, i.e. this.inherited(arguments, [ ... ])
. arguments
always has to be first.
Upvotes: 5