Opened 13 years ago

Closed 9 years ago

#6413 closed enhancement (wontfix) with getters/setters

Reported by: kriszyp Owned by: Kris Zyp
Priority: low Milestone: future
Component: Data Version: 1.1.0
Keywords: letttable getter setter needsreview Cc: wolfram
Blocked By: Blocking:


Add a wrapping mechanism to stores such that items can be directly accessed using normal JS property access and directly modified with normal JS property modification. Getters and setters are used to translate property access to store.getValue calls and property modifications to store.setValue calls. This is based on the define{G|S}etter property in FF and Safari and the lettable hack for IE. I am creating a module dojox.lang.Observable that is a wrapper object that takes a onRead and onRrite listener that are called when read and writes happen. There will also be a that can take a store and add this capability. I am open to using different names for these modules...

Attachments (1)

jsdata.diff (16.9 KB) - added by kriszyp 13 years ago.
JSData and observable

Download all attachments as: .zip

Change History (13)

comment:1 Changed 13 years ago by wolfram

Cc: wolfram added

Changed 13 years ago by kriszyp

Attachment: jsdata.diff added

JSData and observable

comment:2 Changed 13 years ago by guest

I tested this technique for widget template bindings - please have a look at the forum post.

Eventually I'd like to see this as a part of dijit/dojox, so please let me know what you think of it and how to improve it on that level. CLA Manninen

comment:3 Changed 13 years ago by kriszyp

I checked in the dojox.lang.observable module since it is more tested and much more broadly usable. I probably will do some more testing with the JSData (the Dojo Data specific module) before committing it.

comment:4 Changed 13 years ago by Kris Zyp

Milestone: 1.21.3

comment:5 Changed 13 years ago by Kris Zyp

Owner: changed from Jared Jurkiewicz to Kris Zyp

comment:6 in reply to:  description ; Changed 13 years ago by kapouer

Hello, perhaps you'll find that line useful ?

document.location = 'vbscript:ExecuteGlobal("Function vb_global_eval(code): ExecuteGlobal(code): End Function")';

that could simplify
line 220 to 243...

i enjoyed very much that trick !

comment:7 Changed 13 years ago by kapouer

Also to exchange objects, you have to use "Set" statement :

135	                                               cParts.push(
136	                                                        "       Public Property Let "+prop+"(val)",
137	                                                        "               Call "+setName+"(me.data__,\""+prop+"\",val)",
138	                                                        "       End Property",
139	                                                        "       Public Property Get "+prop,
140	                                                        "               Set "+prop+" = "+getName+"(me.data__,\""+prop+"\")",
141	                                                        "       End Property");

hope this helps...

so that

134	                                        }else if(type != 'object'){ // the getters/setters can only be applied to primitives

could be simply replaced by else {....

comment:8 in reply to:  6 Changed 13 years ago by kapouer

Sorry simply adding Set works for objects... but don't work for primitive types...
so i guess some type check must be added.

comment:9 Changed 12 years ago by Kris Zyp

Milestone: 1.31.4

comment:10 Changed 11 years ago by bill

Milestone: 1.4future

comment:11 Changed 9 years ago by ben hockey

Keywords: needsreview added
Priority: highlow

i'm trying to identify stale tickets. if there is a need to keep this ticket open, please replace the "needsreview" keyword with "reviewed". if there is no need to keep this ticket open then please close it.

comment:12 Changed 9 years ago by bill

Resolution: wontfix
Status: newclosed

This is essentially fixed by Presumably we won't do anything more.

Note: See TracTickets for help on using tickets.