A reset button would make it a bit more complicated.  Having a data model would 
be a recommended solution.

I would start a new thread about the datagrid problem, but basically, Spark 
components are not drop-in itemrenderers like MX components.


On 6/12/12 6:40 AM, "Davidson, Jerry" <jerry.david...@illinois.gov> wrote:






I’m sorry.  I wasn’t clear.  I want the button to enable a component (or 
disable it in the case of the reset button).  The component is in the same MXML 
file.

What seems to work seems pretty involved.  I had to bind a variable in the 
component and bind one in the main MXML to pass the state (enabled) in.

The next problem I have is probably simpler, but following two matching google 
solutions that failed to work means there is probably a depth to this problem 
beyond my ignorance.


I just want a check box or radio button to be included in a grid.  Both 
solutions that I tried looked like this:
                 <cust:MyAdvancedDataGrid
                &nbs! p;       id="dgData"
                        width="100%" height="85%"
!
                       textAlign="center"
                        fontWeight="normal"< o>
                        dataProvider="{myData}"
                        selectionMode=! "singleCell"
                        accessibilityName="Case Composition, DataGrid, use 
arrow keys to navigate between cells">
!
                       <cust:columns>
                              <mx:AdvancedDataGridColumn
                                    headerText="Select"
                                    rendererIsEditor="tr! ue"
                                    width="100">
             !                        <mx:itemRenderer>
                                          <fx:Component>
&n! bsp;         &nbs! p;                                     <s:CheckBox 
selected="false"/>
                 &! nbsp;                        </fx:Component>
                                    </mx:itemRenderer>
    &! nbsp;         &nb! sp; ;              </mx:AdvancedDataGridColumn>

It seems straight forward.  Add an itemRenderer as the content of a cell.  To 
enable the control, add a “FX” container.  It doesn’t cause any syntax error, 
but when you run it you get this:

TypeError: Error #1034: Type Coercion failed: cannot convert 
gov.il.dhs.wvs.view.components::UserAA_GridInnerClass0@7cb6cf1 to 
mx.controls.listClasses.IListItemRenderer.
                at 
mx.controls.advancedDataGridClasses::AdvancedDataGridBase/http://www.adobe.com/2006/flex/mx/internal::columnItemRenderer()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\controls\advancedDataGridClasses\AdvancedDataGridBase.as:1634]

               at 
mx.controls::AdvancedDataGridBaseEx/http://www.adobe.com/2006/flex/mx/internal::getMeasuringRenderer()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\controls\AdvancedDataGridBaseEx.as:2812]
                at mx.controls::AdvancedDataGrid/http:! 
//www.adobe.com/2006/flex/mx/internal::getMeasuringRenderer()[! E:\dev\4 
.x\frameworks\projects\datavisualization\src\mx\controls\AdvancedDataGrid.as:4152]
                at 
mx.controls::AdvancedDataGridBaseEx/measureItems()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\controls\AdvancedDataGridBaseEx.as:6225]
                at 
mx.controls::AdvancedDataGridBaseEx/commitProperties()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\controls\AdvancedDataGridBaseEx.as:2274]
                at 
mx.controls::AdvancedDataGrid/commitProperties()[E:\dev\4.x\frameworks\p! 
rojects\datavisualization\src\mx\controls\AdvancedDataGrid.as:2846]
                at 
mx.core::UIComponent/validateProperties()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:7933]
                at 
mx.managers::LayoutManager/validateProperties()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:572]
                at 
mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:730]!
                at 
mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]



From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf 
Of Alex Harui
Sent: Friday, June 08, 2012 3:41 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Activate Component (enable)



Assuming the button and ting you want to enable are in the same MXML file a 
typical set up looks like

<mx:Button label=”enable text search” click=”criteria.enabled = true” />
<mx:TextInput id=”criteria” enabled=false” />

Even more common is the use of checkboxes for enabling

<mx:CheckBox label=”enable text search” id=”enableTextSearch” />
<mx:TextInput enabled=”{enableTextSearch.selected}” />

In which case you can just use binding.

On 6/8/12 12:19 PM, "Davidson, Jerry" <jerry.david...@illinois.gov> wrote:






I couldn’t see how to get to the property from the button.
&n! bsp;

F! rom: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On 
Behalf Of Alex Harui
Sent: Friday, June 08, 2012 11:56 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Activate Component (enable)



Why wouldn’t you set enabled=true on the button click?


On 6/8/12 6:56 AM, "Davidson, Jerry! " <jerry.david...@illinois.gov> wrote:






I have a form that includes a component.  The form includes selection criteria 
and a search button.  When the user clicks the search butto! n, I want to 
enable the component and populate a grid of the results of the search.  Taking 
baby steps, the first thing I want to do is the enabling.

Search                                                                  Results
&nbs! p;          !  &n bsp;  Select office:                                    
              &nb! sp;   Select    Name   ! ; C ase      Office
             Select case:                                                &nbs! 
p;       [ ]   &n! bsp;&nbs p;       x  !             x              x
                Select from date:                       ! ;                     
 [ ]            y              y              y
        &! nbsp;       Select to date:                  &nb! sp;          ! ; & 
nbsp;                    [ ]            z              z          &n! bsp;   z
      ! ; & nbsp;        Search Btn                                      &n! 
bsp;   Details
                                         ! ;                                    
                Start      End        Stuff  &nbs! p;   More Stuff
                               &! nbsp;                                         
          &nb! sp;         1 &nb! sp; ;           1              1              
1
                   &nb! sp;          ! ; & nbsp;                    &! nbsp;    
     &nb! sp; ;                                2              2              2  
  &nb! sp;         2

The results and details sections (in same component) are disabled until a user 
selects stuff.  Step one is to enable the component when the search button is 
clicked and all the edit checks are passed.

I was thinking of passing a boolean in the component bound to a variabl! e that 
is defaulted to false and set to true in the se! arch button code, but that 
didn’t work.  I couldn’t find a property of the component that could be set in 
the search button click event.

TIA,
Jerry





--
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui

Reply via email to