Custom ItemRenderer Problem

Hello,
I have a requirement to display an image in some rows in the
datagrid based on a flag obtained from the database. To achieve
this, I am using a custom itemrenderer for that particular column
and on a simple check if the value obtained for that particular row
is 1 then I show the image, else I leave it blank (i.e set the
image visibility to false).
Here is a snippet of the code:
Custom ItemRenderer
<mx:HBox .... creationComplete="init();">
<mx:Script>
<![CDATA[
public function init( ):void {
// Check if the flag is 0 or 1 to determine whether to show
or hide the image
if(data.@FLAG == 0) {
img.visible = false;
]]>
</mx:Script>
<mx:Image id="img" source="something.gif" />
</mx:HBox>
Main Application
<mx:Application .........>
<mx:DataGrid dataProvider="{myXML.item}" ... >
<mx:columns>
<mx:DataGridColumn dataField="@FLAG" headerText="Image"
itemRenderer="CustomItemRenderer" />
......... // Other columns
</mx:columns>
<mx:DataGrid>
</mx:Application>
This code seems to work to a certain level. However, here are
some problems that i'm facing and would like to know if this is the
right approach:
1. The check to determine whether to show the image doesn't
function well. It shows the image when the flag is 0 and sometimes
doesn't show the image when the flag is 1.
2. Upon scrolling or sorting of the datagrid the results of
the column randomly get messed up losing the images for the ones it
had before scrolling or sorting and sometimes placing the image in
another row it does not belong to.
Can anyone please guide me if they have worked on a similar
requirement and how it can be achieved. My feeling is that I am
performing the check in the wrong method. I tried doing it by
overriding the set data method but that has the scroll problem and
eventually makes all the images visible initially disappear after
scrolling or sorting.
Any help will be much appreciated.
Thank you.

Override the set data property and move the code written in
init() method there:
override public function set data(value:Object):void {
super.data = value;
// Check if the flag is 0 or 1 to determine whether to show
or hide the image
if(data.@FLAG == 0) {
img.visible = false;
once it works, and there is no reason why it shouldn't, read
up more on life cycle of renderers in the docs.
ATTA

Similar Messages

  • TileList bulk image display / custom itemRenderer problem

    I create a tilelist with a custom itemRenderer which will display image loaded with some text description, the source is from XML.
    the image displayed correctly from 1 - 10 itemrenderer.
    The problem happens on the itemrenderer 10+, the image is mismatch with the text description.
    The worse thing is when I scroll the tilelist, the image change row by row that does not match with the text.
    Why ? Any solution for this

    Dear Alex
    Many thanks for your hint. It did solve the problem
    My orginal code make a dirty flag at commitProperties() that image load only once at first time. After your hint, I remove the loading code out and the problem has been solved. Thanks
    However performance wise, the image blind and reload whenever I scoll the tilelist, how can I
    a/ make the scrolling process more smoothly
    b/ the image still in the screen ( no blind and off ) whenever I scroll the tilelist
    Thanks and hope to hear your hint again

  • Items in Tree control move around when data is submitted using custom ItemRenderer

    I'm working on a Tree control with an XMLListCollection as
    its dataProvider.
    The dataProvider has information looking like this :
    quote:
    <?xml version='1.0' encoding='utf-8'?>
    <INFO>
    <FIELD label="STR_USER_NAME"
    type="text"
    value=""
    >
    </FIELD>
    <FIELD label="STR_USER_EMAIL"
    type="text"
    value=""
    >
    </FIELD>
    <FIELD label="STR_OPTIONAL"
    type="branch"
    value="0"
    >
    <FIELD label="STR_USER_ADDRESS"
    type="text"
    value=""
    >
    </FIELD>
    <FIELD label="STR_USER_POSTAL_CODE"
    type="text"
    value=""
    >
    </FIELD>
    </FIELD>
    </INFO>
    So in the Tree control I'd like the information to show up
    with a label and
    an
    editable textbox for each item :
    [Label] [textbox]
    To do this I made a tree like this :
    quote:
    <mx:Tree id="userTree"
    editable="true"
    rendererIsEditor="true"
    editorDataField="curVal"
    itemRenderer="{new ClassFactory(ItemRendererUser)}"
    itemEditEnd="e_ProcessData(event);"
    dataDescriptor="{new DataDescriptorUsers()}"
    showRoot="false"
    verticalScrollPolicy="{ScrollPolicy.AUTO}"
    />
    where the e_ProcessData() function looks like this (I used
    http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/js/html/wwhelp.htm?href=c
    elleditor_073_16.html#202105 as a guide) :
    quote:
    public function e_ProcessData(event:ListEvent):void
    event.preventDefault();
    userTree.editedItemRenderer.data.@value =
    ItemRendererUsers(event.currentTarget.itemEditorInstance).curVal;
    userTree.destroyItemEditor();
    userTree.dataProvider.notifyItemUpdate(userTree.editedItemRenderer);
    } // END OF e_ProcessData()
    I attached the rest of the files because they're a little
    bit longer.
    When I run the program, the data shows up fine when it is
    initialized the
    very
    first time, and I made a test button that just dumps the
    contents of the
    dataProvider in a trace statement to verify that the data has
    been set
    properly.
    The problem I've run into is whenever the textfield is
    edited, the item
    that
    I've selected jumps around the list.
    For example, if I edit the item "STR_USER_NAME" after I
    finish the edit, it
    will move from the very first position in the Tree to the
    bottom of the
    Tree.
    I traced the contents of the dataProvider and the
    dataProvider structure
    stays
    the same, with the "STR_USER_NAME" at the top, but if I look
    at the flex app
    in
    the web browser, its position is at the bottom of the Tree.
    This happens for every other item I try to edit... I read in
    the
    documentation
    that the ItemRenderers are recycled, so it means I should be
    checking to
    make
    sure the initial states are covered, but I'm not sure how
    this affects my
    application.
    Can anyone help me out with this ? Its very confusing - I've
    tried making
    an
    ItemRenderer using pure actionscript, mxml and the
    combination you see in
    this
    example and I always end up with the same behaviour - So I
    must be missing
    something critical...
    // ItemRendererUsers.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    verticalScrollPolicy="{ScrollPolicy.OFF}"
    horizontalScrollPolicy="{ScrollPolicy.OFF}"
    creationComplete="initItemRendererUsers();"
    >
    From my FAQ:
    Q: I've created a custom itemRenderer component to use in a
    List
    based component (Datagrid, TileList, HorizontalList, etc.).
    When my List
    first displays, everything looks fine, but when I scroll it
    or change the
    dataProvider, some of the itemRenderers show values or
    formatting that
    aren't right. How do I fix this?
    A: List-based components don't draw a renderer for every item
    in the
    dataProvider. Instead, they create enough to display what is
    on screen now,
    plus one or two more waiting in the wings. This means they
    recycle the
    renderers rather than creating new ones when you change
    dataProvider or
    scroll up and down. When you use a creationComplete event to
    set up the
    itemRenderer, that event doesn't happen again when the
    renderer is used for
    a different set of data. The solution to this is to override
    the set data
    protected function that most components have.
    For more information, check out the following resources:
    http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html?devcon=f1
    http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.html
    Please note, I post this FAQ weekly, and you can find a
    permanent copy of it
    here
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf

    "peterh8234" <[email protected]> wrote in
    message
    news:gaqttd$kft$[email protected]..
    > Yes - the set and get functions are listed down below.
    But the quirky
    > behaviour
    > is the same regardless of whether I override the set and
    get functions or
    > not.
    >
    > I noticed there was another variable called listData -
    should I be using
    > that
    > one or the data variable to read and write to the
    dataProvider ?
    >
    > // _data
    > [Bindable] public var _data:Object;
    > [Bindable("dataChange")]
    > //
    > override public function get data():Object
    > {
    > trace('[ItemRendererDefault.GET data()] called for {' +
    > _data.attribute("label") + '}.');
    > return _data;
    > } // END OF get data()
    >
    > //
    > override public function set data(value:Object):void
    > {
    > _data.@value = inputText.text;
    > trace('[ItemRendererDefault.SET data()] called for {' +
    > _data.attribute("label") + '}.');
    >
    > invalidateProperties();
    > } // END OF set data()
    Your set data needs to set a flag that gets picked up in
    commitProperties()
    and does your thing that you were doing before in
    creationComplete. You
    should see examples of this in the links I posted. Instead of
    this:
    _data.@value = inputText.text;
    you should look at implementing IDropInListItemRenderer,
    which will allow
    you to dynamically determine which field to look at, instead
    of hardcoding
    it. You also might wind up overwriting the stored value with
    a null value
    when the List passes the stored value in. I'd encourage you
    to really go
    through those links I posted and make sure you understand
    what they're
    saying. The itemRenderer life cycle is one of the hardest
    things to
    understand, but once you understand it, it makes many things
    in Flex much
    easier. It's worth investing the time.

  • Custom ItemRenderer makes the column non editable

    Hi Folks,
    I have a DataGrid which s editable, I've created a custom ItemRenderer to deal with special format needed for Date variables, for that I extended the mx:Text class in order to get access to the listData.dataField variable.
    The problem is that this makes the column non-editable, the other column in the table are editabe.
    When I used a VBox container the column was editable however I didn't get access to the listData, which I need for the dataField variable.
    Any help will be appreciated.
    Thanks,
    MR.
    Here is the my DateItemRenderer code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Text xmlns:fx="http://ns.adobe.com/mxml/2009"
                                    xmlns:s="library://ns.adobe.com/flex/spark"
                                    xmlns:mx="library://ns.adobe.com/flex/mx">
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   import aslib.common.Constants;
                   import aslib.common.Utils;
                   import aslib.connection.JSONConnector;
                   import mx.controls.dataGridClasses.DataGridListData;
                   import mx.controls.listClasses.ListData;
                   import mx.formatters.DateFormatter;
                   [Bindable]
                   private var _dispValue:String;               
                   public function dateStr(val:Object):String {
                        var innerDt:Date;
                        if(!(val is Date))
                             innerDt = Utils.convertDateStr(val as String);
                        else
                             innerDt = val as Date;
                        if(innerDt){
                             var df:DateFormatter = new DateFormatter();
                             df.formatString = "DD/MM/YYYY";
                             var formatedDate:String = df.format(innerDt);                                                       
                             return formatedDate;
                        }else{
                             return "";
                   public override function set data(value:Object):void {
                        var date:Object = value[(listData as DataGridListData).dataField];
                        if(date){
                             _dispValue = dateStr(date);
              ]]>
         </fx:Script>
         <mx:text>{_dispValue}</mx:text>
    </mx:Text>

    OK, found the issue, forgot to add 'super.data = value' in the set data method...

  • How do I make a Custom DataTip with Custom ItemRenderer

    I can't seem to find any documentation or examples of
    displaying a dataTip (similar to those used with charting) with my
    custom itemRenderer (mxml component). This is for use in a
    dataGridColumn. I Could someone give me an example? The closest
    I've been able to find is
    http://www.mail-archive.com/[email protected]/msg61624.html,
    which doesn't say how to do it.
    Thanks!

    http://blog.bigfatstogie.com/?p=42
    run the example towards the end of the page

  • Customer Service Problems

    After fighting with Verizon customer service over two service issues without any possibility of resolution I am canceling my account. 
    I’m doing this reluctantly because as a long-term shareholder of Verizon I would like to see the company succeed and keep profitable.  Yet I am appalled by the cavalier, disrespectful, obstructionist treatment from your staff in dealing with customer service problems.  When you were just the telephone company and operated as a monopoly in a regulated industry, you had to take customer issues seriously.   Now that you are an unregulated telecommunications giant it seems that you don’t feel the need to respond to your customers.  Someone in your company needs to hear this and put a stop to these destructive business practices. 
    In brief, the first issue involved arranging a service call for interruption of internet service.  The entire process kept me on the phone for a total of 3 hours over several days.  I have given up my land line and use a cell phone exclusively.  Verizon’s communication systems and staffing levels caused me to wait on hold for 10-15 for each person that I spoke to. Then each conversation averaged 10 minutes.   In addition, I was transferred to different departments but  I did not understand the reason for the transfers.  Then the pattern of hold-talk-transfer began again.  Several times my calls were dropped necessitating more repeats of the hold-talk-transfer pattern.  Some of your staff were South Asian and they either garbled or misunderstood English, thus prolonging the conversation beyond the average of 10 minutes.    During that time I incurred cell phone charges of $.45/ minute.   
    After the service was restored I called Verizon customer service and asked for a service credit to compensate me for those out-of-pocket expenses over and above 30 minutes which I consider to be a reasonable amount of time to arrange a service call.  They denied any responsibility for the amount of time it took to arrange the service call or the amount of time to complain about their service.  I was not happy with the outcome so I requested to speak with someone who was a decision maker and had authority to negotiate a settlement.  I also asked to have them communicate with me through email.  I was told that communicating through email was not possible.  These calls followed the same pattern of hold-talk-transfer averaging 30 minutes each.  I repeated myself to 3 or 4 people who wrote down my complaint before I got to a manager who had decision making authority.  The manager denied any responsibility for the amount of time it took to arrange the service call and would not authorize a service credit.  
    The second issue involved billing.  I signed up for auto-pay to have my monthly bill deducted directly from my bank account.  Verizon’s computer system deducted the bill twice, overdrawing my account.  I incurred a bank overcharge fee.   The same pattern of hold-talk-transfer began for this complaint as well.  The customer service staff refused to take responsibility for this error as well.  Their solution required me to spend more time and incur extra expenses.  I had to repeat myself to 3 or 4 complaint takers before I reached the same manager who denied my first request.  He denied any responsibility for this billing problem too.    I had to have my bank retrieve the money under a fraud compliant.
    Verizon is one of the largest *communications* corporations in the world.  If your internal systems can't handle customer service calls in a reasonable amount of time, then there is a problem.  If your customer service staff is unwilling to take responsibility for such inadequacies and solve the issues that emerge from them, then there is a problem.  If a customer has to contact the CEO of the company to try to resolve two service related issues, then there is a problem.  When all of those actions prove inadequate, then there is a *communications* problem.
    Customer service has flagged my account and put me down as a “problem” customer.  Instead of offering even a token settlement, they are prepared to stonewall me by maintaining that the company is just not at fault and that they tried to solve the problems but I wouldn’t cooperate or accept their solutions.   Early on in the process, if someone told me that Verizon messed up just a little, but still couldn’t compensate me, I would have accepted that, albeit reluctantly, and dropped the matter.
    This is not the way I do business and I resent it when others don’t feel the need to honor any kind of code.  I grew up working in my family’s retail liquor store.  From the time I was a kid I learned four customer service lessons that I’ve carried over into my adult life:
    Admit when you are wrong and try to make up for the mistake.
    Never argue with a customer over small things.
    Listen to the compliant and don’t just dismiss it out-of-hand
    Try to make things right even though you may not be directly responsible for problem.
    For my two problems, Verizon customer service staff didn’t even come close to following these common sense rules.   I’ve learned that if you ask their customer service people they will repeat back to you some type of business code that they say they operate under.  But their behavior tells a different story.
    Unfortunately when I spoke with {edited for privacy} of the Executive Presidential Appeals office, I was taken somewhat aback by his manner and demeanor, which was coarse and inappropriate for a customer service discussion, and which I found personally offensive.  He and members of his staff agreed to send me emails specifying which part of the Terms of Service they based their decisions on.  To date I have not received the communications they promised.
    Is this the image of your company that you want the public to see? Are you willing to just shrug off these complaints as an isolated case that is too small to concern yourself about?  I’m afraid the answer will be yes.  Not only do you feel that you are too big to fail, but you are too big to care.   Customer service means solving problems not manufacturing bad will and resentment.  
    My purpose in writing this note has been twofold: to make one last effort to solve my problem and to hope that someone will take note about the issues about customer service practices that are harmful to the company. I'd be happy to speak with someone with real authority to deal
    with my issues but have no interest in repeating my past experiences.
    It's too bad that this had to happen since the solution could have been so easy and simple.
    I plan to publish some form of this letter and distribute it to the public. 
    Solved!
    Go to Solution.

    Therefore, I request to please clear this unacceptable due balance, and contact Experian to removed and clarified the mistake in my credit report. 
    RE:  Cancellation fee charged on internet DSL service charged by mistake. {edited for privacy}
    A $65 balance remain for a cancellation fee on internet DSL service, by Verizon New York mistake.
    In February of 2010, I set up my phone and TV in a vacation plan but keep my internet service active. After a month I had a vacation plan, suddenly without notification, my internet service was suspended and a cancellation fee was issued.
    My final statement was $ 24.47. I cleared a check from Verizon.
    I contacted Verizon online to request connect my internet service and discuss the issue on the cancellation fee. The response was that I should pay the internet cancellation fee, and paid a new activation.
    After fighting with Verizon customer service over the unacceptable fee charge service issue without any possibility of resolution I cancel my home phone which was in a vacation plan. 
     Later I kept receiving the statement with this cancellation fee every month. I called and discussed the issue more than 6 times during the next 6 months, The entire process kept me on the phone for a total of 2 hours over several months. The costumer representatives responded that the issue was in an investigation.
    Later,  a Collector company start chasing me to get the $65 paid. Phone number: {edited for privacy}, Inclusive, they made an offer to reduce the amount if I accept to pay or contact Verizon to request a clarification.
    By the end of the year, I contacted Verizon costumer services one more time but the representative stated that the account is not visible anymore.
    Convinced that the problem on this account was resolved, the second week of November, I called Verizon to reestablish my account with a new home phone number and Internet DSL connection.
    The answer was that  following Verizon policy I was unable to get a new account if a balance remain.
    After I explained the events, a manager (non-identified) who spoke to me by phone told me that Verizon will investigate the issue and I should wait for approval.
    On November 16, my account was confirmed approved and clear of debt, therefore, Verizon welcome me back with Home phone and internet DSL Service and confirmation on my online registration.
    New number:{edited for privacy} ; Email:{edited for privacy}
    Also, during the months of January and February 2010, Verizon New York, made other charges mistakes in my account (See details below) that have been resolved with an apologize and a refund.
    Events that prove the lack of training and support Verizon customer and billing service have.
    Chronology of the emails exchanged between Verizon Ecenter and myself after I requested investigation with the charges.
    01/10/10   I have contacted Verizon customer support regarding of a mistake in my internet service statement.Tracking # 430824. Reference: Duplicate charges for Internet Security suites service.
    1/12/10 Verizon eCenter responded. Angela. ' Apologized for the inconvenience. 'The cancellation and credit will appear on the next bill'.
    2/08/10 Verizon eCenter responded. Cheniqua. 'I have issued a credit of $6.52 for a Verizon internet security suite charges'; your internet charges
    2/04/10 I have contacted Verizon customer support in regard of clarification in my Direct TV  statement.
    Tracking # {edited for privacy}. Reference: Balance from Direct TV due to my recently requesting vacation plan.
    2/06/10 Verizon eCenter responded (John) Verizon Bill statement: February 26 = $6,73 paid
    2/06/10 I have contacted Verizon customer support in regard of a mistake in my home phone statement.
    Reference: By mistake, international fee in my home phone (inactive line/vacation plan) was charged.
    Tracking # {edited for privacy}
    2/08/10 Verizon eCenter responded. (Linnette) 'I apologize for the error'. 
    A credit for the international plan has been applied to your account and will appear on the next statement.'
    2/08/10 Verizon eCenter responded (Cheniqua) 'The regional essential calling plan does not qualify for a discount during vacation suspension. Which prove that my home phone was in a vacation plan.
     2/15/10 I have contacted Verizon customer support in regard of a non-notified, neither requested suddenly suspension on my internet DSL service and charged a cancellation fee for this suspension.
    Tracking # {edited for privacy}
    2/16/10 Verizon eCenter responded (Michael)  I am sorry for the inconvenience you have experienced. 
    Please contact our Consumer Sales and Solutions Center directly at 1-800-Verizon or (800) 837-4966 
    Monday through Friday between 8:00 AM to 6:00 PM Local Time. 
    2/16/10 Verizon eCenter (Sue)  responded : I am sorry for the inconvenience you have experienced. 
    I understand your frustration and concern regarding canceling your internet service in error. In order to provide you with the best customer service, please contact our Consumer DSL Sales and Solutions department directly at (800) 567-6789 and a representative will be happy to assist you.
    I stand on my decision of not pay for someone else mistakes.
    Your actions have damaged my integrity as a good costumer and citizenship.
    Without doubt after this problem get clearly resolved, you will lose this good costumer, get a negative feedback and I am planning to publish this letter at every web forum available.

  • Can't focus on custom itemRenderer?

    I have made a custom itemRenderer doubling as an itemEditor
    following the guidelines in the documentation.
    However, even though I have set the rendererIsEditor="true",
    when tabbing amongst other editable fields, the controls inside the
    itemRenderer do not receive focus. I can't help but think this is
    an oversight/bug but is there any way to jury-rig the itemRenderer
    to focus properly? At the moment my component is simply a CheckBox
    inside an HBox.
    Anyway, here is my code so you can see for yourself (I have
    included a CheckBox as itemRenderer so you can see the *desired*
    effect.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:Script>
    <![CDATA[
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.Alert;
    [Bindable]
    public var dp:Array = [{num:2, bool:true}, {num:3,
    bool:false}];
    ]]>
    </mx:Script>
    <mx:DataGrid id="test" editable="true"
    dataProvider="{dp}">
    <mx:columns>
    <mx:DataGridColumn dataField="num" headerText="num" />
    <mx:DataGridColumn dataField="bool"
    headerText="Sent"
    itemRenderer="mx.controls.CheckBox"
    rendererIsEditor="true" editorDataField="selected" />
    <mx:DataGridColumn dataField="num" headerText="num"
    editable="true" />
    <mx:DataGridColumn dataField="bool" headerText="Sent"
    rendererIsEditor="true" editorDataField="blorch">
    <mx:itemRenderer>
    <mx:Component>
    <mx:HBox horizontalAlign="center">
    <mx:Boolean id="blorch" />
    <mx:CheckBox id="check" selected="{data.bool}"
    change="blorch=check.selected" />
    </mx:HBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
    <mx:DataGridColumn dataField="num" headerText="num"
    editable="true" />
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>

    nevermind... I found the answer a few pages later in the
    docs...
    you have to implement the IFocusManagerComponent interface
    and then override drawFocus as below to set the focus on the
    checkBox... hope it works for multiple controls...
    <mx:HBox horizontalAlign="center"
    backgroundColor="#9933EE"
    implements="mx.managers.IFocusManagerComponent">
    <mx:Script>
    <![CDATA[
    override public function drawFocus(focused:Boolean):void {
    check.setFocus();
    ]]>
    </mx:Script>
    <mx:Boolean id="blorch" />
    <mx:CheckBox id="check" selected="{data.bool}"
    change="blorch=check.selected"
    updateComplete="blorch=check.selected" />
    </mx:HBox>

  • ComboBox with custom ItemRenderer

    This is my combobox where I am trying to have a custom renderer:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:ComboBox xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/halo">
         <fx:Script>
              <![CDATA[
              import mx.events.FlexEvent;
              import mx.collections.ArrayCollection;
              import mx.controls.CheckBox;
              public var datas:XML;
              [Bindable]
              var ItemRenderer:ClassFactory;     
              override public function set data(value:Object):void
                   dataProvider = datas["sku" + value.sku];
                   ItemRenderer = new ClassFactory(comboBoxCheckBoxItemRenderer);     
                   itemRenderer = ItemRenderer;
              public function saveCheckState(evt:Event):void
                   var dataProviderItem:Object = dataProvider.getItemAt(dataProvider.getItemIndex(selectedItem));
                   dataProviderItem.selected = CheckBox(evt.currentTarget).selected;
                   dataProvider.setItemAt(dataProviderItem, dataProvider.getItemIndex(selectedItem));     
              ]]>
         </fx:Script>     
    </mx:ComboBox>
    This combobox is used as a custom itemrenderer in datagrid.
    Here is code for comboBoxCheckBoxItemRenderer:
    package modulecode
         import mx.containers.HBox;
         import mx.controls.CheckBox;
         import mx.controls.Label;
         import mx.controls.Spacer;
         public class comboBoxCheckBoxItemRenderer extends HBox
              private var action:Label;
              private var spacer:Spacer;
              private var checkBox:CheckBox;
              public function comboBoxCheckBoxItemRenderer()
                   super();
              override protected function createChildren():void {
                   // Call the createChildren() method of the superclass.
                   super.createChildren();
                   action = new Label();
                   // Add the child component to the custom component.
                   addChild(action);
                   spacer = new Spacer();
                   spacer.percentWidth = 100;
                   // Add the child component to the custom component.
                   addChild(spacer);
                   checkBox = new CheckBox();
                   // Add the child component to the custom component.
                   addChild(checkBox);
              override public function set data(value:Object):void
                   action.text = value.action;
                   checkBox.selected = value.selected;
    What's happening is that nothing is happening untill I drop combobox down in the grids. As the result checkboxes are not selected properly.
    Any help?

    How would I set up a custom itemrenderer to use data binding but properly have selected property in the following code:
    <<mx:itemRenderer>
              <fx:Component>
                   <mx:HBox width="100%">
                        <mx:Label text="{XML(data).action}"/>
                        <mx:Spacer width="100%"/>
                        <mx:CheckBox id="check" selected="{XML(data).selected}"
                                        change="outerDocument.saveCheckState(event);"/>
                   </mx:HBox>
              </fx:Component>
         </mx:itemRenderer>

  • Forcing custom itemRenderer to updateDisplayList?

    Hi, I'm new to flex, and was having some trouble.
    In my project, I have a DataGrid, and a
    BarChart->BarSeries. The DataGrid and the BarSeries share the
    same DataProvider. I've made a custom itemRenderer, so that I can
    click on Bars in the BarSeries and have them be highlighted in
    black. This is done by having the itemRenderer listen for a CLICK
    event, changing a variable that stores what color I want, then
    calling invalidateDisplayList() to have updateDisplayList update
    the display.
    Since DataGrid and BarSeries share the same DataProvider,
    elements in the DataGrid match up with elements in the BarSeries.
    Therefore, I would like to be able to have a user click on an item
    in the DataGrid, and have the associated bar in the BarSeries chart
    become highlighted. However, I can't find a way to get the
    itemRenderer to call updateDisplayList from outside of the
    itemRenderer itself. I thought that calling invalidateDisplayList()
    using the BarChart's id or the BarSeries id would force the
    itemRenderer for the BarSeries to call updateDisplayList() and
    update itself, but by using the debug feature, I have found that it
    does not do this. Does anyone have any advice for how I would be
    able to click on a DataGrid item and have it highlight the
    corresponding item in the BarChart?
    Thanks!

    Hi, I'm new to flex, and was having some trouble.
    In my project, I have a DataGrid, and a
    BarChart->BarSeries. The DataGrid and the BarSeries share the
    same DataProvider. I've made a custom itemRenderer, so that I can
    click on Bars in the BarSeries and have them be highlighted in
    black. This is done by having the itemRenderer listen for a CLICK
    event, changing a variable that stores what color I want, then
    calling invalidateDisplayList() to have updateDisplayList update
    the display.
    Since DataGrid and BarSeries share the same DataProvider,
    elements in the DataGrid match up with elements in the BarSeries.
    Therefore, I would like to be able to have a user click on an item
    in the DataGrid, and have the associated bar in the BarSeries chart
    become highlighted. However, I can't find a way to get the
    itemRenderer to call updateDisplayList from outside of the
    itemRenderer itself. I thought that calling invalidateDisplayList()
    using the BarChart's id or the BarSeries id would force the
    itemRenderer for the BarSeries to call updateDisplayList() and
    update itself, but by using the debug feature, I have found that it
    does not do this. Does anyone have any advice for how I would be
    able to click on a DataGrid item and have it highlight the
    corresponding item in the BarChart?
    Thanks!

  • How To Update Custom ItemRenderer (Image) on DataGrid Edit

    I have an DataGrid with 2 columns, column 1 called "Name" and column 2 called "Actions".
    The "Name" column contains editable text and the "Actions" column uses a (inline) custom ItemRenderer which displays 2 icon images ( for Edit and Delete). All works fine. Clicking Edit or Delete calls the corrosponding outerDocument method.
    The feature I am trying to add is as follows: when someone double-clicks on the text in the Name column to edit it, I would like the edit icon in the Actions column to ( grow/shrink, change color  - or some such indication/reminder to click it ). Not seeing how to do this with the inline ItemRenderer, I created a custom item renderer class and, in that class, use mx:Resize to perform the "grow/shrink". I created a method called "pulse()" and, from within that renderer, all works well. ( for testing, I wired the icons click event to the pulse() method ). However, now I am not sure how to call that ItemRenderers "pulse()" method to perform the effect from the main DataGrid (when the user double-clicks on Name field to edit).
    The tried using the DataGrid's "itemEditBegin", which fires correctly, but from that point I am not sure how to access the selected rows edit icon in the "Action" column. ( to call its pulse() ) method.
    So any suggestions how I can achieve my end result? Being able to manipulate the edit icon in the "Actions" column, when the user double-clicks (edits) that row's "Name" column?
    If I'm going about it all wrong, feel free to offer alternative solutions.
    Any help would be appreciated.
    Thanks,
    ~e

    Hi,
      Check the  BAPI_MATERIAL_SAVEDATA ,in the BAPI  is there a table parameter EXTENSIONIN ?
    which you can use to pass the values for user defined fields to the BAPI..
    Regards
    Kiran Sure

  • Custom itemRenderer - Bug?

    Hi, I have an example of some code that I can't figure out.
    What I'm doing may not be the best way to do what I want, but I
    believe is should work, and can't figure out why it doesn't. I have
    a datagrid with two columns, and the second column uses a custom
    itemRenderer to draw multiple circles depending on nested XML data
    for that row. In the
    set data function of my itemRenderer, I'm trying to get the
    width of the column, and use that to calculate where to put my
    circle, as a value of 1 to 10.
    - The first time, the
    set data is called four times where there are three rows
    - The first time it's called, this.width is zero
    - When resizing column widths, set data is called again - the
    first time only for the 2nd and 3rd rows, but with the correct
    width
    - Subsequent times it's called for all three rows, but the
    first row uses the LAST width, not the new width
    Any ideas? Here's my code:
    Project name is FlexSample, first file is FlexSample.mxml,
    then other two files are MyComponents/MyItemRenderer.as and
    MyComponents/PointComponent.as
    FlexSample.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns="*"
    width="100%" height="100%"
    initialize="init()" horizontalGap="0" verticalGap="0" >
    <mx:Script>
    <![CDATA[
    import mx.events.ResizeEvent;
    import mx.controls.Alert;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.http.HTTPService;
    import mx.events.*;
    [Bindable]
    public var myXML:XML=
    <ROWSET>
    <ROW>
    <POINTS>
    <POINT>
    <POINT_ID>90686</POINT_ID>
    <X_VALUE>2</X_VALUE>
    </POINT>
    <POINT>
    <POINT_ID>90806</POINT_ID>
    <X_VALUE>8</X_VALUE>
    </POINT>
    </POINTS>
    <NOTE_TX>Points are 2 and 8</NOTE_TX>
    </ROW>
    <ROW>
    <POINTS>
    <POINT>
    <POINT_ID>90111</POINT_ID>
    <X_VALUE>4</X_VALUE>
    </POINT>
    <POINT>
    <POINT_ID>90222</POINT_ID>
    <X_VALUE>6</X_VALUE>
    </POINT>
    </POINTS>
    <NOTE_TX>Points are 4 and 6</NOTE_TX>
    </ROW>
    <ROW>
    <POINTS>
    <POINT>
    <POINT_ID>90333</POINT_ID>
    <X_VALUE>1</X_VALUE>
    </POINT>
    <POINT>
    <POINT_ID>90444</POINT_ID>
    <X_VALUE>10</X_VALUE>
    </POINT>
    </POINTS>
    <NOTE_TX>Points are 1 and 10</NOTE_TX>
    </ROW>
    </ROWSET>;
    ]]>
    </mx:Script>
    <mx:DataGrid width="100%" height="100%" id="dgMain"
    dataProvider="{myXML.ROW}"
    fontFamily="Verdana" fontSize="10" color="#000066">
    <mx:columns>
    <mx:DataGridColumn headerText="Note"
    dataField="NOTE_TX"/>
    <mx:DataGridColumn headerText="Points" dataField="POINT"
    id="dgcPoints"
    itemRenderer="MyComponents.MyItemRenderer"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    MyItemRenderer.as
    // ActionScript file
    package MyComponents {
    import mx.controls.*;
    import mx.core.*;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.listClasses.*;
    import flash.display.*;
    import mx.core.*;
    import mx.controls.*;
    import flash.events.*;
    import mx.managers.PopUpManager;
    import mx.events.*;
    public class MyItemRenderer extends mx.core.Container
    implements IListItemRenderer{
    public function MyItemRenderer() {
    super();
    override public function set data(oValue:Object):void {
    this.removeAllChildren();
    //oValue contains whole ROW in XML format...
    var n:int = 0;
    if(this.width==0){
    trace("set data:width 0!");
    if (oValue != null && this.width>0) {
    var m:int = this.getChildren().length;
    var nWidth:int = this.width;
    var xXML:XML = new XML(oValue);
    for(var s:String in xXML.POINTS.children()){
    var nXValue:int = xXML.POINTS.children()[s].X_VALUE;
    //Total width is from 0-9, padding of 5 on left and right to
    account for circle width
    var n:int = (((nXValue -1)/10) * (this.width-10)) + 5;
    trace("set data: Width:" + this.width + " XValue:" + nXValue
    + " X:" + n);
    var u:PointComponent = new PointComponent(0x0000EE, n);
    this.addChild(u);
    PointComponent.as
    package MyComponents
    import mx.core.UIComponent;
    import mx.controls.Alert;
    public class PointComponent extends UIComponent
    public function PointComponent(pnColor:uint, pnX:int){
    super();
    graphics.clear();
    graphics.beginFill(pnColor);
    graphics.drawCircle(pnX, 10, 7);
    }

    A complete runnable example, that's great, I will give it a
    try.
    In the meantime, for "...set data is called four times where
    there are three rows...", I have noticed this as well but have no
    explanation. The first time, the "value" object is "null", so I
    always wrap the code in if (value != null) {}
    I'll post when I get a chance to look at your sample.
    Tracy

  • A DataGrid with a Custom ItemRenderer

    Hi all,
    I have a DataGrid whose DataProvider is bound to a simple Array. I have a custom ItemRenderer that includes a button that can remove the item itself (I don't want two separate columns with a remove button in one of them). However, I don't understand the behaviour - clicking the button rearranges the data in the DataGrid and sometimes duplicate the entries! See the example attached. Any idea what's happening?
    Martin.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete();" xmlns:local="*">
        <mx:Script>
            <![CDATA[
                [Bindable]
                public var _data : Array;
                protected function onCreationComplete() : void {
                    _data = new Array();
                    _data.push(1, 2, 3, 4, 5);
            ]]>
        </mx:Script>
        <mx:VBox>
            <mx:DataGrid dataProvider="{_data}">
                <mx:columns>
                    <mx:DataGridColumn>
                        <mx:itemRenderer>
                            <mx:Component>
                                <mx:HBox implements="mx.controls.listClasses.IDropInListItemRenderer" creationComplete="dataLabel.text = String(data);">
                                    <mx:Script>
                                        <![CDATA[
                                            import mx.collections.ArrayCollection;
                                            import mx.controls.DataGrid;
                                            import mx.controls.listClasses.BaseListData;
                                            protected var _listData : BaseListData;
                                            public function get listData() : BaseListData {
                                                return _listData;
                                            public function set listData(d : BaseListData) : void {
                                                _listData = d;
                                            protected function onClick(e : Event) : void {
                                                var dp : ArrayCollection = (owner as DataGrid).dataProvider as ArrayCollection;
                                                dp.removeItemAt(listData.rowIndex);
                                        ]]>
                                    </mx:Script>
                                    <mx:Label id="dataLabel" width="100%" />
                                    <mx:Button click="onClick(event);"/>
                                </mx:HBox>
                            </mx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
                </mx:columns>
            </mx:DataGrid>
        </mx:VBox>
    </mx:Application>

    creationComplete is rarely used in renderers.  See the itemrenderer posts on my blog
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Combo of T61 and customer support problems

    My main problem is that my T61 freezes up.  It came with a 2 gig ram, sbbb Intel core 2 duo t7500 processor, 1 gig turbo memory window's ultimate 32 bit os and an 80 gig hard drive. This problem has been going on intermittently (odd) since I  received the laptop brand new.  I may or may not be able to move the cursor over the screen when it is frozen.  It does not high light anything, control-alt-delete does not work, nothing responds.  I have to manually hold down the power button to turn the system off.  
    The different things it has done, and not all during the same occurrence:  blue screen with white writing, black screen with white writing, black screen oxc 000000f-selected entry could not be loaded because application is missing or corrupt, the memory was dumped (I had used rescue and recovery backup disks then because I did not know if something was corrupt in the original software that came loaded on it), sometimes it checks the c-drive after being manually shut down, sometimes it does not, problem with window's registry (only did that maybe twice), and corrected master file table, corrected bit map (after checking c). Sometimes it freezes and gives no error messages during restart.  I do not have anything loaded on this system that is not compatible with vista nor anything that exceeds the ram. 
    When I had to use my rescue and recovery disks because everything crashed, I called tech support.  They told me I needed to update my drivers-especially my video driver.  I tried to tell them that I had been going to the lenovo website for driver updates, using pc doc, updating bios, doing a registry cleanup, defraging the hd, and of course window's updates.  So he gave me a link on lenovo's website for another update.  During that call, I told the guy that the recovery disks that came with the laptop loaded XP on my system.  He sent me out vista recovery disks-vista business, not ultimate, and it was freezing up on vista and xp-no matter what program I was using.  The next time I called, lenovo had my computer shipped back and replaced the corrupt 2 gig ram.  It came back with the same software it left with, so I know my hard drive had not been wiped.  On the third call I was told to update my drivers, check the hard drive using bios, that it was my web browser, remove the battery....  By this time I was wondering about technical service which leads me to my other issue.
    I called the month after my warranty ran out, because I thought I had an established history of problems with this $1600+ laptop that has not worked right, and I was told that the warranty had run out, they would not honor it, records after 30 days were wiped-so there went my established history.  Now someone please tell me why a computer company would not keep records of customers warranty work requests?  Especially during the warranty period.  I was then given the number to out of warranty claims who told me it was out of warranty (duh) and she gave me the number to entitlement.  They called me the next day, which was nice but unfortunately I was not expecting their call and did not have all my info available.  Entitlement told me that someone from tech support would call me within the hour.  My computer proceeded to freeze up-so I left it frozen while waiting for tech support to call.  They did not so I called them, was told my warranty was out of date and I was transferred to another number.  Now this entire time I had been polite in my requests and conversations, my family had even alerted them to  a billing error that would have caused another customer some problems.  The tech I was transferred to was extremely rude the entire time.  I was not given the opportunity to explain my situation-which was what entitlement said the call would be about.   I requested mediation, he told me someone would call me within two days, then he proceeded to hang up on me.  No one has called.
    I would appreciate some assistance, in my computer problems and how to get in touch with the right person about customer service.  Thank you.

    obviously you have suffered a lot with the laptop os not working properly, have you tried to disable the turbo memory, sometimes that cause alot of trouble. 
    Regards,
    Jin Li
    May this year, be the year of 'DO'!
    I am a volunteer, and not a paid staff of Lenovo or Microsoft

  • DataGrid tooltip doesn't work for customized itemRenderer

    I have a DataGrid with one column is a customized renderer,
    when I try to use the dataTripFunc, it is not showing tooltips,
    same function works for the other non-customized column, here is
    the code:
    <mx:DataGrid id="myDataGrid" dataProvider="{dataContent}"
    width="100%" height="100%">
    <mx:columns>
    <mx:DataGridColumn dataField="name" headerText=""/>
    <mx:DataGridColumn dataField="DateTime"
    headerText="DateTime" showDataTips="true"
    dataTipFunction="cellDataTipFunc"/>
    <mx:DataGridColumn dataField="ImgBar" headerText="ImgBar"
    itemRenderer="ImgBarCell" minWidth="40" showDataTips="true"
    dataTipFunction="cellDataTipFunc"/>
    </mx:columns>
    </mx:DataGrid>
    public function cellDataTipFunc(item:Object):String {
    return "hello world";
    Where the itemRenderer -- "ImgBarCell" is a customized HBox
    component with a label and image on it.
    The tooltip -- "helloworld" shows up for column "DateTime",
    but not for customized ImgBar.
    Does this one have anything to do with event generation for
    customized itemRenderer? Or a bug in flex2?

    Hi
    The TREX server (service) must started and be contactable by RFC - this can be checked by carrying out the actions listed above. (Refer OSS Note - 866547 Error when accessing TREX server for more details )
    <b>Please have a look at the following SAP OSS Note, which will help -></b>
    Note 851106 - Search in catalog from SRM leads to "Service not reachable"
    <u>Other related OSS Notes</u>
    Note 973594 Cross Catalog Search - Configuration
    Note 894717 Items from Cross Catalogs Result does not appears in step 2
    Note 803731 Cross-category search returns no result
    Note 847137 OCI, cross-catalog search: detail display
    Note 996885 Cross Catalog Search - Timeout while accessing MDM Catalog
    1023487 cross-catalog-serach in portal opens up a duplicate window
    1020025 Item detail display in Cross Catalog Search
    1027352 Item detail display in Cross Catalog Search
    Note 866547 - Error when accessing TREX server
    Note 988427 - Update to TREX 6.1 Rev 27
    Note 994623 - Hierarchy Buffer and BIA
    Note 1030056 - Improvement in the Search within Results feature of CSE
    Note 798988 CCM/CSE: Sorting sometimes returns no results
    Note 778688 TREX_INDEX_MANAGER unit test update_view(): incorrect search
    Note 808754 Display sequence of the characteristics is not changeable
    Note 794325 - Error in OCI transfer in the BAdI /CCM/OCI_SCALEPRI
    Note 745235 Search ability changes to cross-catalog characteristics
    Note 724097 - Search of the comp. in case of structured characteristics
    Note 743643 Search ability change in cross-catalog characteristics
    Note 847551 Displaying date, time, and timestamp in the CSE
    Note 750756 Program for the deletion/clean up of TREX indexes
    Do update me as well.
    Regards
    - Atul

  • Mobile custom itemRenderer adivce: grouping of elements

    Hello,
    I am building a custom itemRenderer for a Flex Mobile app.
    It will be like 3 columns, first 2 with 2 StyleableTextField stacked vertically and the 3rd with just one StyleableTextField.
    I've uploaded a symbolic image of what I mean. (symbolic = fields depicted in image are imaginary - so you know if it doesn't make sense)
    I have all in place and was wondering if I should:
    A) Position all elements based on X and Y with setElementPosition()
    B) Create 2 VGroups for the first 4 StyleableTextFields and position them.
    Worried about speed.
    Thank you.

    Yes A is faster because it has less DisplayObjects, but also Group uses the spark layout system which is a very general layout system capable of handling many use cases.  When you layout elements using setElementSize()/setElementPosition() you are laying things out specific to only your renderer's use case which means less code needs to run and the renderer will be faster.
    You could start with B if you find it easier to code.  Just be sure to test  the performance of your application.  If your scenario feels good on your target devices then you probably don't need to optimize any further.  If it's not fast enough then you might want to try A and see how it compares.

Maybe you are looking for