O'Reilly logo

SproutCore Web Application Development by Tyler Keating

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating custom attribute properties

While the built-in SC.RecordAttribute transforms, String, Boolean, Number, Array, Object, Date, and SC.DateTime, will cover almost all the different types of attributes in your records. If you wish to create a reusable custom transform, this is easily done using SC.RecordAttribute.registerTransform().

For instance, SproutCore provides a class for manipulating colors called SC.Color. If we were sending and receiving a lot of color information to and from a remote data source, it would be nice to add a custom transform so that we could use a color string in the data hash for communicating with the server, but use an SC.Color object in the record for use in the application.

To do this, we would register our own ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required