Select a dataProvider with a ComboBox

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Select a dataProvider with a ComboBox

    When the user makes a selection from a ComboBox (of a list of subjects), how do
    I tell the dataProvider of the display element that the dataProvider has
    changed?

    e.g. <local:DisplayShelf id="shelf" dataProvider="{what_goes_here?}" />


    ZenAndy Guest

  2. Similar Questions and Discussions

    1. ComboBox and e4x dataProvider labelField
      Okay, this should be a common use case but, of course, I am struggling with it. I simply want to populate a mx:ComboBox from the result of a...
    2. ComboBox select Item
      Hi all, i have a combobox with n entities - and on init i want to select e.g. the second entity. I tried to use selectedItem, getChildAt and and...
    3. ComboBox bound to a ComboBox: doesn't work until .changeevent
      Hi, i have two ComboBoxes getting DataProvider from an XMl doc. The XML nodes look like this: <activity label="aerobics"> <level label="low...
    4. Combobox Dataprovider
      I have just downloaded the 60 day trial edition, and am trying to populate a combobox from a java method that returns an array object. I am not...
    5. updating dataProvider
      Hi, when updating the dataProvider attribute of a component, the component doesn't update according to this new state of the dataProvider. Say i...
  3. #2

    Default Re: Select a dataProvider with a ComboBox

    hey

    just the id of the dataProvider should be placed.

    e.g.:

    <mx:ArrayCollection id="arcDP">
    ...
    </mx:ArrayCollection>
    <local:DisplayShelf id="shelf" dataProvider="{arcDP}" />

    dietmar.paulus Guest

  4. #3

    Default Re: Select a dataProvider with a ComboBox

    hi

    ok so far. but I want something like {arcDP.selectedItem} but that doesn't work.

    Can you help me figure out how to just display the images by subject please?
    ZenAndy Guest

  5. #4

    Default Re: Select a dataProvider with a ComboBox

    right this can't work, because an ArrayCollection has no selectedItem, just a
    list or a datagrid can have a selectedItem, and these lists and datagrids are
    based on your dataprovider so you can say.

    <Your List>.selectedItem

    or

    <Your DataGrid>.selectedItem

    A ComboBox has a selectedItem too.

    dietmar.paulus Guest

  6. #5

    Default Re: Select a dataProvider with a ComboBox

    Logically I should be able to use the selectedItem of the ComboBox to tell the
    Display which data to use. Do I have to filter my ArrayCollection to a new
    ArrayCollection with just the data about the selected single subject and make
    that the dataProvider?

    ZenAndy Guest

  7. #6

    Default Re: Select a dataProvider with a ComboBox

    Hey

    can you please specifiy your aim of the application and maybe post some code?

    cheers

    dietmar
    dietmar.paulus Guest

  8. #7

    Default Re: Select a dataProvider with a ComboBox

    Hey this is a short example:

    I have a comboBox with a dataprovider and a textAreat which displays the data
    of the selectedItem of the combobox, if you change the comboBox also the
    display data is changed.

    Hope you search for something like this

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    backgroundColor="white">

    <mx:ComboBox id="cb" dataProvider="{_arcDP}" labelField="name"/>

    <mx:TextArea top="40" width="100%" height="80"
    text="{cb.selectedItem.field1 + ';;;' + cb.selectedItem.field2 + ';;;' +
    cb.selectedItem.field3 + ';;;' + cb.selectedItem.field4}"/>

    <mx:ArrayCollection id="_arcDP">
    <mx:Object name="obj1" field1="Test 1 - Field 1" field2="Test 1 - Field 2"
    field3="Test 1 - Field 3" field4="Test 1 - Field 4"/>
    <mx:Object name="obj2" field1="Test 2 - Field 1" field2="Test 2 - Field 2"
    field3="Test 2 - Field 3" field4="Test 2 - Field 4"/>
    <mx:Object name="obj3" field1="Test 3 - Field 1" field2="Test 3 - Field 2"
    field3="Test 3 - Field 3" field4="Test 3 - Field 4"/>
    <mx:Object name="obj4" field1="Test 4 - Field 1" field2="Test 4 - Field 2"
    field3="Test 4 - Field 3" field4="Test 4 - Field 4"/>
    </mx:ArrayCollection>

    <mx:Script>
    <![CDATA[

    ]]>
    </mx:Script>


    </mx:Application>

    cheers

    dietmar

    dietmar.paulus Guest

  9. #8

    Default Re: Select a dataProvider with a ComboBox

    I get lots of error messages.....

    warning: unable to bind to property 'field4' on class 'Object' (class is not an IEventDispatcher)
    Phread Guest

  10. #9

    Default Re: Select a dataProvider with a ComboBox

    Okay, these are not error messages, these are warnings, and this is just a
    test-application,

    if I would programm it in a real appliaction, I would use Objects of a self
    written class where I have getter and setter methods for my object-fields, so I
    wouldn't have these error messages.

    dietmar.paulus Guest

  11. #10

    Default Re: Select a dataProvider with a ComboBox

    Thank you for your help and advice. I missed your earlier question about the
    application and sample code.
    See [url]http://demo.quietlyscheming.com/displayShelf/index.html[/url]

    I have hundreds of images which I want to display. I want the user to be able
    to select a small group of images (by "subject") from a ComboBox. I have tried
    many solutions but none have worked so far.

    I have an XML file with the image data.
    <pre>
    <photolibrary>
    <!-- Table images -->
    <images>
    <idx>1</idx>
    <subject>Aerial Views</subject>
    <date>1820</date>
    <caption>plan</caption>
    <filename>di_001.jpg</filename>
    </images>
    <images>
    <idx>2</idx>
    <subject>Aerial Views</subject>
    <date>1950s</date>
    <filename>di_002.jpg</filename>
    </images>
    </pre>

    Does that help?

    Phread Guest

  12. #11

    Default Re: Select a dataProvider with a ComboBox

    Thank you for your help and advice. I missed your earlier question about the
    application and sample code.
    See [url]http://demo.quietlyscheming.com/displayShelf/index.html[/url]

    I have hundreds of images which I want to display. I want the user to be able
    to select a small group of images (by "subject") from a ComboBox. I have tried
    many solutions but none have worked so far.

    I have an XML file with the image data.
    <pre>
    <photolibrary>
    <!-- Table images -->
    <images>
    <idx>1</idx>
    <subject>Aerial Views</subject>
    <date>1820</date>
    <caption>plan</caption>
    <filename>di_001.jpg</filename>
    </images>
    <images>
    <idx>2</idx>
    <subject>Aerial Views</subject>
    <date>1950s</date>
    <filename>di_002.jpg</filename>
    </images>
    </pre>

    Does that help?

    Phread Guest

  13. #12

    Default Re: Select a dataProvider with a ComboBox

    Thank you for your help and advice. I missed your earlier question about the
    application and sample code.
    See [url]http://demo.quietlyscheming.com/displayShelf/index.html[/url]

    I have hundreds of images which I want to display. I want the user to be able
    to select a small group of images (by "subject") from a ComboBox. I have tried
    many solutions but none have worked so far.

    I have an XML file with the image data.
    <pre>
    <photolibrary>
    <!-- Table images -->
    <images>
    <idx>1</idx>
    <subject>Aerial Views</subject>
    <date>1820</date>
    <caption>plan</caption>
    <filename>di_001.jpg</filename>
    </images>
    <images>
    <idx>2</idx>
    <subject>Aerial Views</subject>
    <date>1950s</date>
    <filename>di_002.jpg</filename>
    </images>
    </pre>

    Does that help?

    Phread Guest

  14. #13

    Default Re: Select a dataProvider with a ComboBox

    Thank you for your help and advice. I missed your earlier question about the
    application and sample code.
    See [url]http://demo.quietlyscheming.com/displayShelf/index.html[/url]

    I have hundreds of images which I want to display. I want the user to be able
    to select a small group of images (by "subject") from a ComboBox. I have tried
    many solutions but none have worked so far.

    I have an XML file with the image data.
    <pre>
    <photolibrary>
    <!-- Table images -->
    <images>
    <idx>1</idx>
    <subject>Aerial Views</subject>
    <date>1820</date>
    <caption>plan</caption>
    <filename>di_001.jpg</filename>
    </images>
    <images>
    <idx>2</idx>
    <subject>Aerial Views</subject>
    <date>1950s</date>
    <filename>di_002.jpg</filename>
    </images>
    </pre>

    Does that help?

    Phread Guest

  15. #14

    Default Re: Select a dataProvider with a ComboBox

    Thank you for your help and advice. I missed your earlier question about the
    application and sample code.
    See [url]http://demo.quietlyscheming.com/displayShelf/index.html[/url]

    I have hundreds of images which I want to display. I want the user to be able
    to select a small group of images (by "subject") from a ComboBox. I have tried
    many solutions but none have worked so far.

    I have an XML file with the image data.
    <pre>
    <photolibrary>
    <!-- Table images -->
    <images>
    <idx>1</idx>
    <subject>Aerial Views</subject>
    <date>1820</date>
    <caption>plan</caption>
    <filename>di_001.jpg</filename>
    </images>
    <images>
    <idx>2</idx>
    <subject>Aerial Views</subject>
    <date>1950s</date>
    <filename>di_002.jpg</filename>
    </images>
    </pre>

    Does that help?

    Phread Guest

  16. #15

    Default Re: Select a dataProvider with a ComboBox

    Thank you for your help and advice. I missed your earlier question about the
    application and sample code.
    See [url]http://demo.quietlyscheming.com/displayShelf/index.html[/url]

    I have hundreds of images which I want to display. I want the user to be able
    to select a small group of images (by "subject") from a ComboBox. I have tried
    many solutions but none have worked so far.

    I have an XML file with the image data.
    <pre>
    <photolibrary>
    <!-- Table images -->
    <images>
    <idx>1</idx>
    <subject>Aerial Views</subject>
    <date>1820</date>
    <caption>plan</caption>
    <filename>di_001.jpg</filename>
    </images>
    <images>
    <idx>2</idx>
    <subject>Aerial Views</subject>
    <date>1950s</date>
    <filename>di_002.jpg</filename>
    </images>
    </pre>

    Does that help?

    Phread Guest

  17. #16

    Default Re: Select a dataProvider with a ComboBox

    Thank you for your help and advice. I missed your earlier question about the
    application and sample code.
    See [url]http://demo.quietlyscheming.com/displayShelf/index.html[/url]

    I have hundreds of images which I want to display. I want the user to be able
    to select a small group of images (by "subject") from a ComboBox. I have tried
    many solutions but none have worked so far.

    I have an XML file with the image data.
    <pre>
    <photolibrary>
    <!-- Table images -->
    <images>
    <idx>1</idx>
    <subject>Aerial Views</subject>
    <date>1820</date>
    <caption>plan</caption>
    <filename>di_001.jpg</filename>
    </images>
    <images>
    <idx>2</idx>
    <subject>Aerial Views</subject>
    <date>1950s</date>
    <filename>di_002.jpg</filename>
    </images>
    </pre>

    Does that help?

    Phread Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139