Dynamic checkboxes

Dynamic checkboxes

Post by Xyre » Fri, 23 May 2008 22:16:14

Hi, I'm trying to create a bunch of checkboxes based on a xml file, The idea
would be something like a tree, but with checkboxes instead of the elements
inside a branch of a tree, you know, like:
class 1:
[] topic 1
[] topic 2
[] topic 3
class 2:
[] media 1
[] media 2
[] media 3

The problem is that I haven't seen anything like it and I would not like to
harcode it inside the flex program, I was thinking about using a repeater but I
don't know how to approach this problem so it fits inside the form I have, it's
500px wide, 600px high and the checkboxes would be a lot, the form is already
inside an accordion.

I don't know what other information would be necessary, I appreciate any light
anyone can shed over this, thanks.

Dynamic checkboxes

Post by EvolvedDS » Fri, 23 May 2008 23:41:05

Well as far as a repeater goes, you could try something like the code I've got
below. You will need to establish a dataprovider to give your repeater
something to repeat!

This example assumes your table has a column named 'title' (text type) and a
column named 'isChecked' (boolean type). The title column is the title or
description of your table records and the isChecked column signifies the
true/false or yes/no property of your record.

<mx:Repeater dataProvider="{your_dataprovider}" id="repeatid">
<mx:Label text="{repeatid.currentItem.title}"/>
<mx:CheckBox selected="{repeatid.currentItem.isChecked}"/>


Dynamic checkboxes

Post by ntsii » Sun, 25 May 2008 05:41:51

Sure, DataGrid is better if you have a lot of items.

Item Renderers, are a bit tricky. Do not start from scratch, but find an
example an modify it. I have a checkbox example on www.cflex.net.