|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
markAsCleanI was using onInit function call to create some new fields in a
HopObject. When doing that, Helma will mark the node as dirty. I needed a method of reseting the node as clean so that unnecessary updates to the data base was not done. So I created a new HopObject function call 'markAsClean' that can be called to remove the node from the dirty list. Other people may find this a useful feature also so I would like to suggest that it be considered for implementation into Helma. Thanks, Kris PS - I am aware of the cache feature to allow storing fields into the HopObject for temporary storage. In my case, it was much better to create HopObject fields with default values. If the user changed the default values, then they are stored. If nothing was entered, then the default values are not stored reducing storage overhead. _______________________________________________ Helma-user mailing list Helma-user@... http://helma.org/mailman/listinfo/helma-user |
|
|
Re: markAsCleanOn Sun, 2008-05-04 at 18:49 -0700, Kris Leite wrote:
> In my case, it was much better to > create HopObject fields with default values. If the user changed the > default values, then they are stored. If nothing was entered, then > the default values are not stored reducing storage overhead. This would probably be even better accomplished like this: this.__defineGetter('favColor',function(){ return this.favColor_ === undefined ? 'red' : this.favColor_; }); this.__defineSetter('favColor',function(val){ val == 'red' ? (delete this.favColor_) : this.favColor_ = val; return val; }); -- Joshua Paine <joshua@...> _______________________________________________ Helma-user mailing list Helma-user@... http://helma.org/mailman/listinfo/helma-user |
|
|
Re: markAsCleanUsing getter/setters for this is possible. I find the simple assignment
statement in onInit to be much less code, execute overhead, and debugging needed. The markAsClean function can be useful in other situations besides this one. Joshua Paine wrote: > On Sun, 2008-05-04 at 18:49 -0700, Kris Leite wrote: > >> In my case, it was much better to >> create HopObject fields with default values. If the user changed the >> default values, then they are stored. If nothing was entered, then >> the default values are not stored reducing storage overhead. >> > > This would probably be even better accomplished like this: > > this.__defineGetter('favColor',function(){ > return this.favColor_ === undefined ? 'red' : this.favColor_; > }); > this.__defineSetter('favColor',function(val){ > val == 'red' ? (delete this.favColor_) : this.favColor_ = val; > return val; > }); > > Helma-user mailing list Helma-user@... http://helma.org/mailman/listinfo/helma-user |
| Free embeddable forum powered by Nabble | Forum Help |