Datagrid itemrenderer & evaluation of different column

Hey All,
I've been playing with this for a while but can't get it right.  Basically, I have an itemrenderer that has an image and label, but I need to see what the value is of a different column before I know what image to use.  I have a feeling the reason why my intended logic won't work is becasue the data[] does not reporesent the whole data structure...but I could be wrong.
This is what I have now:
I have a grid that references this itemrenderer & the grid dataprovider is an array collection:
Form
<s:GridColumn dataField="employee"  headerText="Employee"
                 itemRenderer="com.mycompany.view.assets.renderers.EmployeeStatusColour"></s:GridColumn>
Item Renderer
<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
     ....>
  <fx:Script>
       <![CDATA[
          override public function prepare(hasBeenRecycled:Boolean):void {  
          //THIS WORKS BUT NEED TO ADD LOGIC
               lblData.text = data[column.dataField];
               statusImage.source = "com/mycompany/view/assets/images/dot_GREEN.png";
          //THIS IS WHAT I WANT INSTEAD - SYNTAX BELOW IS WRONG BUT YOU'LL GET THE IDEA
               lblData.text = data[column.dataField];
               if(data[column(3)]; = "MONDAY"{
                    statusImage.source = "com/mycompany/view/assets/images/dot_GREEN.png";
               }else{
                    statusImage.source = "com/mycompany/view/assets/images/dot_BLUE.png";
        ]]>
  </fx:Script>
          <s:HGroup verticalAlign="middle" height="100%" gap="2">
          <s:Image id="statusImage"/>
          <s:Label id="lblData" paddingTop="5"/>
  </s:HGroup>
</s:GridItemRenderer>
Thanks in advance to anybody who can direct me to a solution.
Flex

Hi,
I tried your suggestion but it didn't work.   Thanks though! 
However, if you see the code below this works as I stated above.  data[column.dataField] returns the value of the referenced value. 
override public function prepare(hasBeenRecycled:Boolean):void {
                                        lblData.text = data[column.dataField];
                                        statusImage.source = "com/mycompany/view/assets/images/dot_green.png";
So I did a debug inside my item renderer and found that the data object had all the object values of the row from my grid, which is what I want.  I just don't know how to access them individually to do my comparison.  It's probably something really easy like
If (data[column(4).dataField]=="MONDAY"){  
           statusImage.source = "com/mycompany/view/assets/images/dot_GREEN.png";
I know I'm close just don't know the syntax.
Thanks!

Similar Messages

  • How to make the navigation tree icon in an advanced datagrid to expand in different columns

    Hi All ,
    I am using an application built using Flex 3 .
    In my application I am using an AdvancedDataGrid for datadisplay.
    And the hierachy is like this
    Tree structure in advanced datagrid at present :
    Header 1
    Header 2
    Header 3
    Header 4
    Header 5
    Parent Tree
       Expanded1
          Expanded2
              Expanded3
                     ParentTree
    Expanded1
    Expanded2
    Expanded3
    value
    Expected tree structure in advanced datagrid :
    Header 1
    Header 2
    Header 3
    Header 4
    Header 5
    ParentTree
    Expanded1
    Expanded2
    Expanded3
    value
    can someone tell me if this is possible in advanced data grid and if possible please let me know how do i expand the tree icons in seperate columns ...
    Thanks ,
    Ajantha

    Hi,
    you can check the view source of html and check the onclick code written on that plus sign(Expand All), just copy that onclick javascript code and put it on page javascript event.
    Thanks,
    Jaydip Bosamiya
    +91-76000 23053
    http://jbosamiya.blogspot.com

  • Using a custom itemrenderer in datagrid to update value in the same row but different column/cell

    Here's what I have so far.  I have one datagrid (dg1) with enable drag and another datagrid (dg2) with dropenabled.  Column3 (col3) of dg2 also has a custom intemrenderer that's just a hslider.
    When an item from dg1 is dropped on dg2, a custom popup appears that asks you to use the slider in the popup to set a stress level.  Click ok and dg2 is populated with dg1's item as well as the value you selected from the popup window.  I was also setting a sliderTemp variable that was bound to the itemrender slider to set it but that's obviously causing issues as well where all the itemrenderer sliders will change to the latest value and I don't want that.
    What is needed from this setup is when you click ok from the popup window, the value you choose from the slider goes into dg2 (that's working) AND the intemrenderer slider needs to be set to that value as well.  Then, if you used the intemrenderer slider you can change the numeric value in the adjacent column (col2).   I just dont know how to hook up the itemrenderer slider to correspond with that numeric value (thatds be in col2 on that row);
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"
                        xmlns:viewStackEffects="org.efflex.mx.viewStackEffects.*" backgroundColor="#FFFFFF" creationComplete="init(event)"
                        xmlns:components="components.*" xmlns:local="*">
         <mx:Script>
              <![CDATA[
                   import mx.binding.utils.ChangeWatcher;
                   import mx.collections.ArrayCollection;
                   import mx.controls.Alert;
                   import mx.controls.TextInput;
                   import mx.core.DragSource;
                   import mx.core.IUIComponent;
                   import mx.events.CloseEvent;
                   import mx.events.DataGridEvent;
                   import mx.events.DragEvent;
                   import mx.events.FlexEvent;
                   import mx.events.ListEvent;
                   import mx.events.SliderEvent;
                   import mx.events.SliderEventClickTarget;
                   import mx.managers.DragManager;
                   import mx.managers.PopUpManager;
                   import mx.utils.ObjectUtil;
                   [Bindable]private var myDP1:ArrayCollection;
                   [Bindable]private var myDP2:ArrayCollection;
                   [Bindable]public var temp:String;
                   [Bindable]public var slideTemp:Number;
                   private var win:Dialog;     
                   protected function init(event:FlexEvent):void{
                        myDP1 = new ArrayCollection([{col1:'Separation from friends and family due to deployment'},{col1:'Combat'},{col1:'Divorce'},{col1:'Marriage'},
                             {col1:'Loss of job'},{col1:'Death of a comrade'},{col1:'Retirement'},{col1:'Pregnancey'},
                             {col1:'Becoming a parent'},{col1:'Injury from an attack'},{col1:'Death of a loved one'},{col1:'Marital separation'},
                             {col1:'Unwanted sexual experience'},{col1:'Other personal injury or illness'}])
                        myDP2 = new ArrayCollection()
                   protected function button1_clickHandler(event:MouseEvent):void
                        event.preventDefault();
                        if(txt.text != "")
                             Alert.yesLabel = "ok";                    
                             Alert.show("", "Enter Stress Level", 3, this,txtClickHandler);
                   private function image_dragEnter(evt:DragEvent):void {
                        var obj:IUIComponent = IUIComponent(evt.currentTarget);
                        DragManager.acceptDragDrop(obj);
                   private function image_dragDrop(evt:DragEvent):void {
                        var item:Object = dg2.selectedItem;                    
                        var idx:int = myDP2.getItemIndex(item);
                        myDP2.removeItemAt(idx);
                   protected function dg1_changeHandler(event:ListEvent):void
                        temp=event.itemRenderer.data.col1;     
                   protected function dg2_dragDropHandler(event:DragEvent):void
                        event.preventDefault();                         
                        dg2.hideDropFeedback(event as DragEvent)
                        var win:Dialog = PopUpManager.createPopUp(this, Dialog, true) as Dialog;
                        win.btn.addEventListener(MouseEvent.CLICK, addIt);
                        PopUpManager.centerPopUp(win);                              
                        win.mySlide.addEventListener(Event.CHANGE, slideIt);
                   private function txtClickHandler(event:CloseEvent):void {
                        trace("alert");
                        if (event.detail==Alert.YES){
                             myDP2.addItem({label:temp});
                   private function addIt(event:MouseEvent):void{                    
                        myDP2.addItem({col1:temp, col2:slideTemp})
                   private function slideIt(event:SliderEvent):void{                    
                        slideTemp = event.target.value;               
              ]]>
         </mx:Script>
                   <mx:Panel x="10" y="10" width="906" height="481" layout="absolute">
                        <mx:Image x="812" y="367" source="assets/woofie.png" width="64" height="64" dragDrop="image_dragDrop(event);" dragEnter="image_dragEnter(event);"/>
                        <mx:DataGrid x="14" y="81" width="307" height="251" dragEnabled="true" id="dg1" dataProvider="{myDP1}" wordWrap="true" variableRowHeight="true" change="dg1_changeHandler(event)">
                             <mx:columns>
                                  <mx:DataGridColumn headerText="Examples of Life Events" dataField="col1"/>
                             </mx:columns>
                        </mx:DataGrid>
                        <mx:DataGrid x="329" y="81" height="351" width="475" dragEnabled="true" dropEnabled="true" id="dg2"
                                        wordWrap="true" variableRowHeight="true" dataProvider="{myDP2}" editable="true"
                                        dragDrop="dg2_dragDropHandler(event)"  rowHeight="50" verticalGridLines="false" horizontalGridLines="true" >
                             <mx:columns>
                                  <mx:DataGridColumn headerText="Stressor" dataField="col1" width="300" wordWrap="true" editable="false">
                                  </mx:DataGridColumn>
                                  <mx:DataGridColumn headerText="Stress Level" dataField="col2" width="82" editable="false"/>
                                  <mx:DataGridColumn headerText="Indicator" dataField="col3" width="175" paddingLeft="0" paddingRight="0" wordWrap="true" editable="false">
                                       <mx:itemRenderer>
                                            <mx:Component>
                                                 <components:Compslide/>
                                            </mx:Component>
                                       </mx:itemRenderer>
                                  </mx:DataGridColumn>
                             </mx:columns>
                        </mx:DataGrid>                    
                        <mx:Text x="14" y="10" text="The first category of underlying stressors is called Life Events. The list includes both positive and negative changes that individuals experience. Both can be stressful. For example, becoming a parent is usually viewed as a positive thing, but it also involves many new responsibilities that can cause stress. " width="581" height="73" fontSize="12"/>
                        <mx:TextInput x="10" y="380" width="311" id="txt"/>
                        <mx:Text x="10" y="335" text="Add events to your list that are not represented in the example list.  Type and click &quot;Add to List&quot;&#xa;" width="311" height="51" fontSize="12"/>
                        <mx:Button x="234" y="410" label="Add to List" click="button1_clickHandler(event)"/>
                   </mx:Panel>     
    </mx:Application>

    how do i go about doing that?  do i put a change event function in the itemrenderer?  and how would i eventually reference data.col2?

  • DataGrid itemRenderer done in code?

    I've searched for info on how to implement itemRenderer for a
    DataGrid, and despite seeing some docs and examples, they're all
    very different from what I think I want, and what I think should
    also be possible.
    Here's what I want: for one column (called "alert"), I want
    to be able to programmatically display an appropriate image (or
    even just render a character, such as "X") based on the data value
    of that cell.
    I would think it should be something like this:
    <mx:Script>
    private function RenderAlert(... ? ) :String {
    if (data == "delayed") return "D"
    else if (data == "canceled") return "X"
    </mx:Script>
    <mx:DataGrid ...>
    <mx:columns>
    <mx:DataGridColumn headerText="Alert" dataField="alert"
    itemRenderer="RenderAlert"/>
    </mx:columns>
    </mx:DataGrid>
    So, if anyone can point me to an example like this, I'd be
    very appreciative. I'm really hoping it's possible, as all the
    other methods I've seen illustrated don't appear to handle the
    render decisions in code.
    Thanks!

    By default, I'm not exactly sure what each cell is.I'm sure
    if we dug into the docs somewhere it would tell us..
    I've always done any conditional stuff in my itemrenderer
    component.
    Specifically in the set data function which you should
    override:
    i.e the following is a snippet that sets a combobox
    itemrenderer in a datagrid. It gets the ID of the current object
    being rendered then looks it
    up in an arraycollection to get the "english/display name" of
    that ID then sets that as the selected item in the combo box
    override public function set data(value:Object):void {
    yy = this.parentApplication.AC_semesters;
    if ((value != null) && (yy != null) &&
    yy.length > 0) {
    a_course = Course(value);
    this.invalidateProperties();
    for (var i:int = 0; i < yy.length; i++)
    var firstItem:Object = yy.getItemAt(i);
    var myid:int = a_course.crs_semester;
    if (firstItem.sem_id == myid)
    cb3.selectedIndex = i;
    so in your case you could make up an itemrenderer component
    being a label, then in your set data function, have a conditional
    check to set the label.text = "X" if the value passed in is equal
    to whatever.
    Hope this helps...

  • DataGrid header functionality to manipulate column data

    I have been displaying information for individual series in a chart via a datagrid so that the user can edit it (change color, series style, etc.) And it works fine, but now I need to add in some functionality in the header of the series style column.  Basically the user needs to be able to "override" each entry to make all of the series types lines or area or plot or whatever he chooses in the header.  In my research on the net, it looks like I may have to use AdvancedDataGrid to do this.  Does anyone know how I would do this.
    Here's what I have so far.  I've left out most of the other columns for simplicity.
    <mx:DataGrid id="seriesTable" color="black" fontSize="9" rowHeight="30" editable="true" resizeEffect="slow" rollOverColor="#CCCCCC"
    selectionColor="#999999" dataProvider="{axis.seriesList}" width="100%"
    rowCount="{axis.seriesList.length > 2 ? axis.seriesList.length : 2}" >
      <mx:columns>
             <mx:DataGridColumn width="40" dataField="color" headerText="Color" id="colorColumn"
                        rendererIsEditor="true"  editorDataField="result" itemRenderer="renderer.ColorPickerRenderer"/>
             <mx:DataGridColumn dataField="plotType" width="220" id="plotColumn"
                       rendererIsEditor="true"  editorDataField="result" itemRenderer="renderer.TypeBoxRenderer"/>
          </mx:columns>
    </mx:DataGrid>
    (I could also include TypeBoxRender code but I don't think it's really needed to understand what is going on here.)

    I have been displaying information for individual series in a chart via a datagrid so that the user can edit it (change color, series style, etc.) And it works fine, but now I need to add in some functionality in the header of the series style column.  Basically the user needs to be able to "override" each entry to make all of the series types lines or area or plot or whatever he chooses in the header.  In my research on the net, it looks like I may have to use AdvancedDataGrid to do this.  Does anyone know how I would do this.
    Here's what I have so far.  I've left out most of the other columns for simplicity.
    <mx:DataGrid id="seriesTable" color="black" fontSize="9" rowHeight="30" editable="true" resizeEffect="slow" rollOverColor="#CCCCCC"
    selectionColor="#999999" dataProvider="{axis.seriesList}" width="100%"
    rowCount="{axis.seriesList.length > 2 ? axis.seriesList.length : 2}" >
      <mx:columns>
             <mx:DataGridColumn width="40" dataField="color" headerText="Color" id="colorColumn"
                        rendererIsEditor="true"  editorDataField="result" itemRenderer="renderer.ColorPickerRenderer"/>
             <mx:DataGridColumn dataField="plotType" width="220" id="plotColumn"
                       rendererIsEditor="true"  editorDataField="result" itemRenderer="renderer.TypeBoxRenderer"/>
          </mx:columns>
    </mx:DataGrid>
    (I could also include TypeBoxRender code but I don't think it's really needed to understand what is going on here.)

  • Datagrid itemrenderer issue

    I have created a datagrid which has suppose 4 columns out of which 1 has an option of setting as favorite just like we have in our every mail servers (gmail, yahoo, outlook, etc). I have used a linkbutton as an item renderer and its toggle property as true. so wenever i click on it its getting selected and i have used skin for selected and normal state which is a star.
    The problem is that when data length exceeds and scrollbar comes in datagrid and whenever i scroll down and up the stars which are not selected are getting selected or in some scenarios the whole column stars get selected.
    How to get rid of this problem ?

    Can I see the itemrenderer code.  I'm assuming that you aren't clearing the values from previous objects in you
    override protected function set data( value:Object ):void call.
    Sincerely ,
      Ubu/

  • Datagrid itemRenderer dynamic values

    While working on an application I came across the following
    problem. I've got a view with a datagrid, where I have several
    columns. Each column needs 2 values displayed beneath each other in
    one cell. You make an itemRenderer with 2 labels inside a VBox.
    Easy so far. However since this scenario repeats several times it
    seems counterproductive to make an itemRenderer for each cell. How
    can I make the text property for the labels change for each cell
    instead of being static in their values.
    Thx in advance.

    Your description of your requirements and your sample code do
    not paint a clear enough picture.
    Your dataProvider has 4 pieces of data: batchId,
    bookingNumber, valueDate, immsBranch. Your current itemRenderer
    references two of those pieces of data, and you say you want to
    reference the other two. You can do that easily like this:
    <mx:Label text="data.valueDate"/>
    <mx:Label text="data.immsBranch"/>
    A basic question: will your DataGrid have two rows for each
    set of 4 pieces of data? If so then I understand your problem. If
    not, then you must clarify exactly how and when you would like the
    4 pieces of data shown in your DataGrid.
    In any case, you probably need a Repeater, and then need to
    figure out how to get at the right data at the right time in the
    Repeater.
    See this FB 3 help topic and its sub-topics:
    Dynamically Repeating Controls and Containers
    Also search for this in the FB3 help to see the API:
    mx.core.Repeater
    You can define a listener for the Repeater for the Repeat
    event to specify processing for each iteration of the
    repeater.

  • Datagrid itemRenderer checkbox

    Hi,
    I have datagrid control in my application and I use itemRenderer to render some data received from webservice. Works just fine but I would like to disable changing state of checkbox. I am using checkbox renderer just to show data more user friendly and not that users can check and uncheck it. So how can I disable checking and unchecking (by user click interaction) my checkbox in datagrid?
    I my example column with dataField "IsAlive" is the one rendered by CheckBox component.
    <mx:DataGrid id="lstAllPushes" left="10" right="10" top="10" bottom="60">
    <mx:columns>
    <mx:DataGridColumn headerText="ID" dataField="ID"/>
    <mx:DataGridColumn headerText="Start date" dataField="DateInserted"/>
    <mx:DataGridColumn headerText="Expiration date" dataField="DateExpiration"/>
    <mx:DataGridColumn headerText="Alive" dataField="IsAlive" itemRenderer="mx.controls.CheckBox"/>
    </mx:columns>
    </mx:DataGrid>
    Thx in advance.

    Try this:
    <mx:DataGridColumn headerText="Alive" dataField="IsAlive" >
         <mx:itemRenderer>
              <mx:Component>
                   <mx:CheckBox enabled="false"/>
              </mx:Component>
         </mx:itemRenderer>
    </mx:DataGridColumn>

  • How to Get DataGrid ItemRenderer Controls?

    Dear, I want to get Controls (Radio Buttons) from DataGrid within itemRenderer on Item Click event.
    Can you give me a sample code?
    =====================================================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%">
        <mx:Script>
            <![CDATA[
                import mx.events.*;
                import mx.controls.Alert;
                private function P4R_Y_change(e:Event):void
                    Alert.show(e.toString());
                private function P4R_N_change(e:Event):void
                    Alert.show(e.toString());
                private function onItemClick_gvPendingForReceipt(e:ListEvent):void
                    // want to get radio buttons here
                   Alert.show((e.target as DataGrid).columns[e.columnIndex].toString());
            ]]>
        </mx:Script>
        <mx:Panel title="Pending for Receipt (NGO only)">
            <mx:DataGrid id="gvPendingForReceipt" itemClick="onItemClick_gvPendingForReceipt(event)">
                <mx:dataProvider>
                    <mx:Object Case_No="cn8385738" JS_Name="Peter Wong" Remarks="" >
                    </mx:Object>
                    <mx:Object Case_No="cn4428255" JS_Name="Mary Queen" Remarks="Referal from SWD Special team!!">
                    </mx:Object>       
                </mx:dataProvider>   
                <mx:columns>
                    <mx:DataGridColumn headerText="Case #" width="150" dataField="Case_No" >
                    </mx:DataGridColumn>
                    <mx:DataGridColumn headerText="Job Seeker Name" width="150" dataField="JS_Name" >
                    </mx:DataGridColumn>       
                    <mx:DataGridColumn headerText="Accept Case?" width="200" >
                        <mx:itemRenderer>
                            <mx:Component>
                                <mx:VBox>
                                    <mx:RadioButton id="rdoP4R_Y" label="Yes" group="{IsAccepted}" >
                                    </mx:RadioButton>
                                    <mx:RadioButton id="rdoP4R_N" label="No" group="{IsAccepted}" >
                                    </mx:RadioButton>       
                                    <mx:RadioButtonGroup id="IsAccepted">
                                    </mx:RadioButtonGroup>           
                                </mx:VBox>   
                            </mx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
                    <mx:DataGridColumn headerText="Remarks">
                        <mx:itemRenderer>
                            <mx:Component>
                                <mx:TextInput text="{data.Remarks}">
                                </mx:TextInput>
                            </mx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>                       
                </mx:columns>   
            </mx:DataGrid>
        </mx:Panel>
        <mx:Panel title="Pending for Intake (NGO only)">
        </mx:Panel>
        <mx:Panel title="Active Case List (NGO/ Case Management">
        </mx:Panel>
    </mx:VBox>
    Regards,
    Man Pak Hong, Dave
    [email protected]
    Analyst Programmer.

    This code may help.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    <mx:Script>
    <![CDATA[
    import mx.controls.DataGrid;
    import mx.events.ListEvent;
    [Bindable]
    private var nameStr:String;
    public function getName(event:ListEvent):void {
    var dg:DataGrid = DataGrid(event.target);
    nameStr = dg.selectedItem.cn;
    ]]>
    </mx:Script>
    <mx:ArrayCollection id="acEmaillist">
    <mx:Object>
    <mx:cn>Bob Smith</mx:cn>
    <mx:mail>[email protected]</mx:mail>
    </mx:Object>
    <mx:Object>
    <mx:cn>Ted Alan</mx:cn>
    <mx:mail>[email protected]</mx:mail>
    </mx:Object>
    <mx:Object>
    <mx:cn>Fred Tobs</mx:cn>
    <mx:mail>[email protected]</mx:mail>
    </mx:Object>
    </mx:ArrayCollection>
    <mx:DataGrid dataProvider="{acEmaillist}"
    itemClick="getName(event)">
    <mx:columns>
    <mx:DataGridColumn headerText="Full Name" dataField="cn"
    width="150"/>
    <mx:DataGridColumn headerText="Email" dataField="mail"
    width="150"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:Label text="{nameStr}"/>
    </mx:Application>

  • Flex 4 - Datagrid add checkbox to a column

    Hello all.
    I am trying to add a checkbox to a datagrid column, so that i can use it to delete a record from the array.  My datagrid is as follows
        <mx:DataGrid x="10" y="40" width="903" dataProvider="{questionsArr}" sortableColumns="false" draggableColumns="false" editable="true">
            <mx:columns>
                <mx:DataGridColumn headerText="No." dataField="Number" width="100" editable="false"/>
                <mx:DataGridColumn headerText="Question" dataField="Question" />
                <mx:DataGridColumn headerText="Delete"  width="100" />
            </mx:columns>
        </mx:DataGrid>
    The user inputs questions into the array via a textinput box.
    But what i want to do is add a checkbox to the "Delete" column.  If anyone could help me with this that would be great !

    Ok, thanks both for your answers.
    I have now gone about doing it the following way:
        <mx:DataGrid x="10" y="40" width="903" dataProvider="{questionsArr}" sortableColumns="false" draggableColumns="false" editable="true">
            <mx:columns>
                <mx:DataGridColumn headerText="No." dataField="Number" width="100" editable="false"/>
                <mx:DataGridColumn headerText="Question" dataField="Question" />
                <mx:DataGridColumn headerText="Delete"  width="100">
                        <mx:itemRenderer>
                            <fx:Component>
                                <mx:HBox horizontalAlign="center" verticalAlign="middle">
                                    <s:CheckBox/>
                                </mx:HBox>
                            </fx:Component>
                        </mx:itemRenderer>
                </mx:DataGridColumn>
            </mx:columns>
        </mx:DataGrid>
    It works fine, as i add a question, a checkbox gets added to the Delete column.  Alls great.
    But when i come to click on the checkbox, the following text gets displayed [object Object]
    Then when i click away from the checkbox the checkbox reappears.  With it either selected or unselected depending on what value it should be.
    Is there anyway so that it dosent display the [object Object] ?

  • Datagrid itemrenderer

    <mx:Component
    id="cb">
    <mx:CheckBox click="click()" label="{data.ID}" selected="false">
    <mx:Script>
    <![CDATA[
    private function click():void
    data.select=this.selected;
    ]]>
    </mx:Script>
    </mx:CheckBox>
    </mx:Component> 
    <mx:DataGrid>
    <mx:DataGridColumn headerText="Sec" dataField="select" editorDataField="selected" itemRenderer="{cb}" visible="true" width="70" rendererIsEditor="true"/></mx:DataGrid>
    hi..
    I get data from datagride database via xml. I've got datagrid checkboxes. When I choose any checkbox and when a new data comes, the checkboxes of some lines are shown as chosen as well.
    how can I solve this problem?

    Hi,
    It looks like, you have to bind the data with item renderer. I have modified your code which may help you to understand.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:XML id="dp">
            <root>
                <node label="Parent 1" selected="true"/>
                <node label="Parent 2" selected="true"/>
            </root>
        </mx:XML>
    <mx:DataGrid id="dg" dataProvider="{dp.children()}">
        <mx:columns>
            <mx:DataGridColumn headerText="Label" dataField="@label"    />
            <mx:DataGridColumn headerText="Selected" dataField="@selected"    />
            <mx:DataGridColumn headerText="Sec" >
                <mx:itemRenderer>
                    <mx:Component>
                        <mx:CheckBox click="click()" >
                            <mx:Script>
                            <![CDATA[
                              override public function set data(value:Object):void
                                super.data = value;
                                selected = value.@selected == "true";
                              private function click():void
                                data.@selected=this.selected;
                            ]]>
                            </mx:Script>
                        </mx:CheckBox>
                    </mx:Component>
                </mx:itemRenderer>
            </mx:DataGridColumn>
        </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    -Arivu

  • How to get multiple records in one row and different column

    Hi All,
    I am using oracle database 11g
    and i have a two tables table_1, table_2
    table_1 having columns
    emp_no
    first_name
    middle_name
    last_name
    email
    and table_2 having columns
    emp_no
    phone_type
    phone_number
    and having entires
    emp_no phone_type phone_number
    1001 MOB 9451421452
    1001 WEMG 235153654
    1001 EMG 652341536
    1002 MOB 9987526312
    1003 WEMG 5332621456
    1004 EMG 59612356
    Now i want the output of values with phone type as MOB or WEMG in a single row with different columns
    emp_no first_name middle_name last_name email mobile officeno
    1001 mark null k [email protected] 9451421452 235153654
    1002 john cena gary [email protected] 9987526312 null
    1003 dany null craig [email protected] null 5332621456
    1004 donald finn sian [email protected] null null
    can i have any inputs to achive this???
    Regards
    $sid

    Frank Kulash wrote:
    sonething like this:Frank, you missed aggregate function (pivot requires one). However main thing is it will cause ORA-01748:
    with table_1 as (
                     select 1001 emp_no,'mark' first_name,null middle_name,'k'last_name,'[email protected]' email from dual union all
                     select 1002,'john','cena','gary','[email protected]' from dual union all
                     select 1003,'dany',null,'craig','[email protected] null' from dual union all
                     select 1004,'donald','finn','sian','[email protected]' from dual
         table_2 as (
                     select 1001 emp_no,'MOB' phone_type,9451421452 phone_number from dual union all
                     select 1001,'WEMG',235153654 from dual union all
                     select 1001,'EMG',652341536 from dual union all
                     select 1002,'MOB',9987526312 from dual union all
                     select 1003,'WEMG',5332621456 from dual union all
                     select 1004,'EMG',59612356 from dual
    SELECT     *
    FROM     table_1      t1
    JOIN     table_2      t2  ON  t1.emp_no = t2.emp_no
    PIVOT     (    max(t2.phone_number)
         FOR  t2.phone_type  IN  ( 'MOB'   AS mob
                                 , 'WEMG'  AS wemg
            FOR  t2.phone_type  IN  ( 'MOB'   AS mob
    ERROR at line 19:
    ORA-01748: only simple column names allowed hereYou need to:
    with table_1 as (
                     select 1001 emp_no,'mark' first_name,null middle_name,'k' last_name,'[email protected]' email from dual union all
                     select 1002,'john','cena','gary','[email protected]' from dual union all
                     select 1003,'dany',null,'craig','[email protected] null' from dual union all
                     select 1004,'donald','finn','sian','[email protected]' from dual
         table_2 as (
                     select 1001 emp_no,'MOB' phone_type,9451421452 phone_number from dual union all
                     select 1001,'WEMG',235153654 from dual union all
                     select 1001,'EMG',652341536 from dual union all
                     select 1002,'MOB',9987526312 from dual union all
                     select 1003,'WEMG',5332621456 from dual union all
                     select 1004,'EMG',59612356 from dual
         table_3 as (
                     select  t1.emp_no,first_name,middle_name,last_name,email,
                             phone_type,phone_number
                       FROM     table_1      t1
                       LEFT JOIN     table_2      t2  ON  t1.emp_no = t2.emp_no
    SELECT     *
    FROM     table_3
    PIVOT     (    max(phone_number)
         FOR  phone_type  IN  ( 'MOB'   AS mob
                                 , 'WEMG'  AS wemg
        EMP_NO FIRST_ MIDD LAST_ EMAIL                     MOB       WEMG
          1004 donald finn sian  [email protected]
          1003 dany        craig [email protected] null            5332621456
          1001 mark        k     [email protected]      9451421452  235153654
          1002 john   cena gary  [email protected]    9987526312
    SQL>SY.

  • Not able to display data in different columns using Unicode encoding

    Hi,
    Iam using Unicode encoding in my Java appln to support Japanese characters while downloading CSV report. But using the Unicode encoding displays all data in the first column of Excel sheet.
    Please let me know how to display data in different columns using Unicode encoding in Excel sheet.

    Hi Venkat,
    After extracting data into DSO check the request whether active or not.
    Check data in DSO in contents.
    If is there any restrictions on info providers in Queries.
    Let us know status clearly.......
    Reg
    Pra

  • IR - if count (primary key) cannot change to count different column

    Apex 4.1.1.00.23 Windows 7 IE8 / Firefox 16
    If I add a Group By and Count to an Interactive report and choose the primary key column as the one to Count, run the report and then edit the Group By to count a different column, the result set does not change, and if I edit the Group By again it shows that the Counted column has reverted back to the primary key column.
    If I initially choose a different column I can change it and rerun the report successfully, but once I choose the primary key column it cannot be changed. This seems to happen on all applications and all browsers. Is it a bug in Apex?
    Thanks,
    Nick.

    I've tried this in 4.1.0.00.32: works normally. In 4.1.1.00.23 however i'm getting the weird behaviour: you can count on any column, but the moment you count the same column as the one grouped on you can not change the column back to another one anymore. Something which works fine in 4.1.0.00.32.

  • BO xi 3.1 u2013 schedule a template for multiple reports with different column

    Hi,
    I need to migrate the existing reports from SQL Server Reporting Services to BO, and the column order in the report is very important to the clients since clients have existing code to ingest these reports into their database. Now I want to schedule a single template with different parameters for all reports in BO, or create a single template with lot of parameters for all reports. My question is how I might use one template to create multiple reports with different column orders in the reports?
    For example, client A has the following column order in their report: firstName, LastName, DateBirth, SSN. Client B has the following column order in their report: SSN, DateBirth, LastName, FirstName. Can I use one template to create these multiple reports?
    Thanks!

    Hi,
    The only approach I can think of is to create a template report which uses variables
    For each column you would need to variable
    v_columnAName and v_columnAValue
    v_columnAName would have a if statement in it
    =if([client]="clientA" or [client]="clientC";NameOf([firstName]);if([client]="clientB";NameOf([SSN]);NameOf([lastName]));
    v_columnA would have a if statement in it
    =if([client]="clientA" or [client]="clientC";[firstName];if([client]="clientB";[SSN],[lastName]));
    This would only work when you had a small set of clients.
    This might be more managable if it was done in the universe
    Regards
    Alan

Maybe you are looking for