Opened 12 years ago

Closed 8 years ago

Last modified 8 years ago

#6212 closed defect (wontfix)

Cannot define ItemFileWriteStore._saveCustom with dojo/method SCRIPT tag

Reported by: ptwobrussell Owned by: dylan
Priority: low Milestone: future
Component: Data Version: 1.0
Keywords: Cc: ptwobrussell@…
Blocked By: Blocking:

Description (last modified by bill)

I noticed tonight (r13076) that doing something like

<div dojoType="dojo.data.ItemFileWriteStore" url="/foobar" jsId="fooStore">
    <script type="dojo/method" event="_saveCustom" args="saveCompleteCallback, saveFailedCallback">
        alert("foobar!!!");
    </script>
</div>

doesn't actually do anything. After you supposedly wire it up, you can go into Firebug and execute fooStore._saveCustom and you won't get anything back. However, if you rig that same thing up in dojoAddOnLoad by directly assigning an anonymous functionto fooStore._saveCustom, then all is well (obviously.)

The only telling sign I noticed is that _saveCustom isn't explicitly defined in ItemFileWriteStore?...but I thought that the dojo/method scripts should have worked anyway....so I'll log this as a Core problem (?)

Attachments (1)

dojoMethod.html (685 bytes) - added by bill 8 years ago.
test case using dojo.store.Memory

Download all attachments as: .zip

Change History (10)

comment:1 Changed 12 years ago by ptwobrussell

Noticed this in the support forum. Apparently, this issue has been going on since Nov 07 (at least.)

http://dojotoolkit.org/forum/dojo-core-dojo-0-9/dojo-core-support/custom-event-not-firing-when-saving-itemfilewritestore

comment:2 Changed 12 years ago by bill

Milestone: 1.4
Owner: changed from anonymous to alex

Hmm, well if you had specified the _saveCustom parameter in the tag, like <div dojoType="ItemFileReadStore" _saveCustom="foo">, since _saveCustom isn't declared in the prototype I would just close this as "not a bug". For <script> maybe we can do something better although not sure. Will leave to Alex.

comment:3 Changed 10 years ago by bill

Component: CoreParser
Description: modified (diff)

comment:4 Changed 10 years ago by James Burke

Milestone: 1.4future

comment:5 Changed 8 years ago by Chris Mitchell

Owner: changed from alex to dylan

please review/triage

comment:6 Changed 8 years ago by talisto

I'm running into this issue with v1.7; it doesn't seem like any custom methods can be assigned to the ItemFileReadStore/ItemFileWriteStore? (and likely other modules) using script tags, though this doesn't seem to be an issue for other Dojo modules. Is there a mixin that provides that functionality? In the case of _saveCustom/_saveEverything, perhaps it would be best to declare them in the module as false? That shouldn't affect the behaviour of the module.

comment:7 Changed 8 years ago by ben hockey

Keywords: needsreview added
Priority: highlow

Bill is any of kitson's work possibly going to fix this?

comment:8 Changed 8 years ago by bill

Resolution: wontfix
Status: newclosed

No, the parser is already calling

new dojo.data.ItemFileWriteStore({
    _saveCustom: ...
});

The "problem" is that the ItemFileWriteStore "widget" doesn't mixin it's attributes.

The new dojo.store.Memory does actually mixin the values, so the code snippet below will work:

<div dojoType="dojo.store.Memory" jsId="fooStore">
    <script type="dojo/method" event="_saveCustom" args="saveCompleteCallback, saveFailedCallback">
        alert("foobar!!!");
    </script>
</div>

Of course the Memory store doesn't take a URL.

Anyway, I guess we should close this as wontfix.

comment:9 Changed 8 years ago by bill

Component: ParserData
Keywords: needsreview removed

Changed 8 years ago by bill

Attachment: dojoMethod.html added

test case using dojo.store.Memory

Note: See TracTickets for help on using tickets.