#15289 closed defect (fixed)
syncMode: true leads to "rpcConfig is not defined"
Reported by: | Primus | Owned by: | haysmark |
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | DojoX Data | Version: | 1.6.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
When you create a JsonRestStore? and specify a syncMode: true attribute, this leads to a "rpcConfig is not defined" error when you try to save new items in the store.
I tracked the bug to line nr 347 in dojox/data/JsonRestStore.js.
Originally (Dojo 1.7.2) this line reads :
rpcConfig._sync = true;
This needs to be changed to :
dojox.rpc._sync = true;
rpcConfig is not configured anywhere, maybe this was renamed in some old version. Changing it to the line I mentioned above seems to fix the problem.
Attachments (1)
Change History (10)
comment:1 Changed 9 years ago by
Milestone: | tbd → 1.8 |
---|---|
Owner: | changed from Kris Zyp to haysmark |
Status: | new → assigned |
comment:2 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 follow-up: 4 Changed 9 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
need to add a dependency (probably "dojox"
) to get a handle to dojox.rpc
rather than accessing it as a global
comment:4 Changed 9 years ago by
Replying to neonstalwart:
need to add a dependency (probably
"dojox"
) to get a handle todojox.rpc
rather than accessing it as a global
I attached a patch, is this what you meant? Besides adding the dojox dep, I noticed in dojox.rpc that people were calling getObject to ensure dojox.rpc existed.
comment:5 Changed 9 years ago by
Priority: | undecided → high |
---|
comment:6 Changed 9 years ago by
that looks right... you could possibly use the return value from lang.getObject
if you wanted to
define(['dojox', ...], function (dojox, ...) { var rpc = lang.getObject('rpc', true, dojox); // ... // at the appropriate place in the code rpc._sync = true; }
or an alternative that doesn't use the dojox dep is:
define([...], function (...) { var rpc = lang.getObject('dojox.rpc', true); // ... // at the appropriate place in the code rpc._sync = true; }
the reason for needing to do this is because the "dojox" global variable can be remapped to a different name so you can't rely on a global reference. by pulling dojox in as a dependency, we are using the locally scoped variable dojox
which will be the same variable that gets remapped in the global scope. additionally, lang.getObject
is aware of the remapping so lang.getObject('dojox.rpc', true);
will add the rpc
property to the globally remapped "dojox" global.
basically, you can't rely on any global references.
comment:8 Changed 9 years ago by
Version: | 1.7.2 → 1.6.0 |
---|
This was actually a regression from 1.6->1.7.
In [29061]: