30apr
If you create a scaffold for your rails project, it will create for you a lot of things; for example, a way to show your object in xml format. But what about adding custom elements to that xml?
I solved in this way:
class MyObject < ActiveRecord::Base
#[...]
def to_xml(options={})
cp = attributes.clone
cp["something"] = "some value"
cp["another thing"] = self.some_relation.length
cp.to_xml(options)
end
end
Tags: ruby on rails, xml
24apr
When using wx:TileList with your own ItemRenderer, you have to remember two important things to avoid scrolling problems:
- If you override the set data method, remember to call super.data = value.
- Remember that the TileList reuses the ItemRenderer instances when scrolling the component! So, if you have a TileList with 5 rows and 5 cols, and an array with 500 elements as DataProvider, it will create about 25 instances of your ItemRenderer, calling the set data method on them when scrolling. So, if you add some child to your ItemRenderer under some data condition (like I did), remember to remove them if the data condition is not valid.
Tags: actionscript 3, Flex
Recent Comments