Any one of you know about the difference between ItemRenderer and Repeater.
Both are behaving the same almost. Any difference is there?
Any one of you know about the difference between ItemRenderer and Repeater. Both are
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not sure how they could be behaving the same, but without seeing your code, it is hard to judge. I will try to explain the difference; or rather; what each one is.
Under the hood An itemRenderer is a ClassFactory. A factory is a design pattern for a class that creates other classes. In the context of Flex, itemRenderers are used in list based classes, such as a DataGrid or List. The list based classes accept a dataProvider and only render the elements seen on the screen. As you scroll through the list, each component generated by the itemRenderer is reused. I call this renderer recycling. So, it is important that you implement your itemRenderer to respond to the dataChange event so it is always properly rendering the data it is supposed to represent. More info on itemRenderer components.
A Repeater is like a loop in MXML. Using a repeater does not provide any of the “renderer” benefits that a list based class does. Everything created inside your loop is renderered at once.
So, let’s say you have a dataProvider with 100 images. You have space to show 10 of them on screen. With a list based class, flex will render and load 10 images; changing what is loaded as you scroll through the list. With a Repeater Flex will render and load all 100 at once even though not all of them are on the screen.