Custom renderer in datagrid, needs to know if data changed

Hi,
I am hoping someone can help me out please.
I have a datagrid that uses a custom renderer that is
subclassed from a TextInput. When the user changes the data in a
cell, I need to color the cell. This is so that on a potentially
big grid, the user can easily see which cells he has made changes
to.
It is easy enough to set the color of the itemrenderer by
using setStyle() inside the overridden set data() method of the
custom renderer, but that is only a fraction of the solution. Since
Flex instantiates and destroys custom renderers at will depending
on if it is scrolled into view by the datagrid, keeping the state
of whether a value has changed inside the custom rendererer is not
an option.
So the only choice I have is to call back from the custom
renderer into the container that hosts the datagrid. As the
itemEditEnd event is handled in that container, a list of cells
that have had their data changed can be stored. The custom renderer
then needs to call back into the container with its cell
coordinates and ask if the data has changed, and if it has, set its
color.
How can a custom renderer know its cell position as x,y
coordinates? I see that TextInput implements IListItemRenderer
interface and has properties x and y, but putting a trace on these
gives me nonsensical numbers that seem to have no relation to the
cell coordinates.
The other thing I need to do is have the custom renderer call
back into the container that hosts the datagrid to know whether
data has changed. Is outerDocument the reference? Or is there a
proper way of doing this?
Thanks for the help you can give.

Here is a simplified version of how we track the cell by cell
changes in a datagrid. It does require you to identify the fields
that will be editable and maintaining the original data for each
column in the data source.
Our production version is much more complex than this but it
will give you the idea.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="initApp()"
viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import mx.binding.utils.BindingUtils;
import mx.collections.ArrayCollection;
import mx.core.Application;
import flash.events.*;
import mx.events.DataGridEvent;
import mx.controls.TextInput;
[Bindable] public var editAC : ArrayCollection = new
ArrayCollection();
[Bindable]
public var somedata:XML = <datum><item>
<col0>0</col0>
<col1></col1>
<col2></col2>
<col3>2</col3>
<col4></col4>
<col5></col5>
<col6></col6>
<col0Orig>0</col0Orig>
<col1Orig></col1Orig>
<col2Orig></col2Orig>
<col3Orig>2</col3Orig>
<col4Orig></col4Orig>
<col5Orig></col5Orig>
<col6Orig></col6Orig>
</item>
<item>
<col0></col0>
<col1></col1>
<col2></col2>
<col3></col3>
<col4></col4>
<col5></col5>
<col6></col6>
<col0Orig></col0Orig>
<col1Orig></col1Orig>
<col2Orig></col2Orig>
<col3Orig></col3Orig>
<col4Orig></col4Orig>
<col5Orig></col5Orig>
<col6Orig></col6Orig>
</item>
<item>
<col0></col0>
<col1></col1>
<col2></col2>
<col3></col3>
<col4></col4>
<col5></col5>
<col6></col6>
<col0Orig></col0Orig>
<col1Orig></col1Orig>
<col2Orig></col2Orig>
<col3Orig></col3Orig>
<col4Orig></col4Orig>
<col5Orig></col5Orig>
<col6Orig></col6Orig>
</item>
<item>
<col0></col0>
<col1></col1>
<col2></col2>
<col3></col3>
<col4></col4>
<col5></col5>
<col6></col6>
<col0Orig></col0Orig>
<col1Orig></col1Orig>
<col2Orig></col2Orig>
<col3Orig></col3Orig>
<col4Orig></col4Orig>
<col5Orig></col5Orig>
<col6Orig></col6Orig>
</item>
<item>
<col0></col0>
<col1></col1>
<col2></col2>
<col3></col3>
<col4></col4>
<col5></col5>
<col6></col6>
<col0Orig></col0Orig>
<col1Orig></col1Orig>
<col2Orig></col2Orig>
<col3Orig></col3Orig>
<col4Orig></col4Orig>
<col5Orig></col5Orig>
<col6Orig></col6Orig>
</item>
<item>
<col0></col0>
<col1></col1>
<col2></col2>
<col3></col3>
<col4></col4>
<col5></col5>
<col6></col6>
<col0Orig></col0Orig>
<col1Orig></col1Orig>
<col2Orig></col2Orig>
<col3Orig></col3Orig>
<col4Orig></col4Orig>
<col5Orig></col5Orig>
<col6Orig></col6Orig>
</item>
</datum>
private function initApp():void {
var dgcols:Array = grid1.columns;
for (var i:int=1;i<12;i++) {
var dgc:DataGridColumn = new DataGridColumn();
if(i < 6) {
dgc.width=60;
dgc.editable=true;
dgc.dataField="col" + i.toString() ;
dgc.rendererIsEditor=true;
var ir :DGItemRenderer = new DGItemRenderer();
dgc.itemRenderer = ir;
else {
dgc.width=0;
dgc.visible = false
dgc.dataField="col" + i.toString() + "orig" ;
dgcols.push(dgc);
grid1.columns = dgcols;
]]>
</mx:Script>
<mx:DataGrid x="31" y="27" width="200" height="150"
id="grid1" dataProvider="{somedata.children()}"
horizontalScrollPolicy="on" rowHeight="25"
editable="true">
<mx:columns>
<mx:DataGridColumn headerText="Column 0"
dataField="col0" width="30" editable="false"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:TextInput xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="init()"
implements="mx.controls.listClasses.IDropInListItemRenderer,
mx.core.IFactory"
>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.dataGridClasses.DataGridListData;
public function newInstance():* {
var ir : DGItemRenderer = new DGItemRenderer();
return ir;
override public function set data(value:Object):void
super.data = value;
if (value != null) {
var colName : String= DataGridListData(listData).dataField;
var valOrig : String = data[colName + "Orig"];
var val : String = data[colName];
if(valOrig != val)
this.setStyle("backgroundColor",0xA7FF3F);
else
this.setStyle("backgroundColor", "#ffffff");
]]>
</mx:Script>
</mx:TextInput>

Similar Messages

  • I need to know the date of the last Monday

    I need to know the date of the last Monday
    If today is Monday then I need todays date
    If today is Tuesday then I need yesterdays date etc....
    If today is Sunday then I need to know the date 6 days ago etc....

    the day() function will tell you what day of now() is as an integer: 1=Sunday 7=Saturaday.
    You know that Monday is 2.  The difference between today's number and Monday's number (with a little mathmatical juggling to wrap Sunday to the previous week  -- I would probably just convert -1 to 6 with a simple if statement after substracting 2 from the day() value.).
    Subtracting (adding a negative value) of this difference with the dateAdd() function will give you the date of that previous Monday.

  • HT201359 I need to know a date when I purchased on itunes

    I received a bill on July 31, 2013 stating that I purchased 2 candy crush saga items.  I need to know the date that I purchased these items.
    <Email Edited by Host>

    This is a user-to-user forum, you are not speaking with Apple here.
    Review this article for information on how to view your purchase history: http://support.apple.com/kb/ht2727

  • HT5312 I need to know how to change my security questions cause I have forgotten  them and would like to buy an app but cannot cause I need to answer the questions

    I need to know how to change my security questions cause I have forgotten  them and would like to buy an app but cannot cause I need to answer the questions

    The page that you’ve posted from has instructions for how to reset them i.e. if you have a rescue email address set up on your account then steps 1 to 5 half-way down that page should let you reset them.
    If you don't have a rescue email address then you will need to contact iTunes Support / Apple to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down the HT5312 page that you posted from to add a rescue email address for potential future use

  • I need to know how to change the identity (email address) used for the iTunes store as I no longer use that email

    I need to know how to change the identity (email address) used for the iTunes store as I no longer use that email.

    Settings > iTunes & App store.
    Tap AppleID, sign out then sign back in.
    The Apple ID is right everywhere else. I've synced the phone. I've reset it in Settings on the phone. I've changed it at Apple.
    When you write, "I've changed it at Apple, this means you updated yoru old AppleID or you ceated a new AppleID?

  • When closing and reopening, my tabs aren't restoring like the once did. My history is only keeping one day. Need to know how to change these settings.

    When closing and reopening Firefox, my tabs aren't restoring like they once did. I used to have all my tabs restore each time I opened Firefox. Now it starts with one fresh new tab and all my others are lost. I do a lot of research so this is important.
    My history is only displaying one day even though I have never changed my settings even after I updated it last year.
    Need to know how to restore these settings.
    ***OH! special note: I can't use the recently closed tabs or recently closed windows because its a grayed out option****

    Are you using cleanup software like CCleaner?
    If you use [[Clear Recent History]] to clear the 'Browsing History' when you close Firefox then restoring tabs from the last session ("Save & Quit" or "Show my windows and tabs from last time") doesn't work.
    * http://kb.mozillazine.org/Session_Restore
    There are other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    *Java Plug-in 1.6.0_05 for Netscape Navigator (DLL Helper)
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • Urgent - Need to know that the changed roles are saved in which request ?

    Hi *,
    I was required to include a query in a specified role. I went to T-code PFCG, gave the role name and went into the changed mode. Then in the authorization data, I assigned the query. After that I saved and clicked on Generate button.
    Now, I want to know these changes are captured in which request ?
    Please guide me the possible ways so that I can assign points for the useful answers.
    Regards,
    Srinivas

    Dear Srinivas D Rao  ,
    Once the changes are done ,it will be captured in IDOC and you go to bd87 transaction and give message type and press execute...
    Check in su53 Authorization check transaction
    Also
    To see Authorization a User has through
    transaction suim.
    --> users by complex selection criteria
    >by authorization values
    > Enter authorization object "F_BKPF_BUK "
    >press enter and enter company code
    execute ... you will find the users
    You need to find roles assigned to the user first then go to table agr_1252 anf give the value $BUKRS along with the role names.
    Also check tables UST12 and AGR_1251.
    Hope it helps
    Regards
    Bala

  • Hi i need to know how to change my security questions cause i dont remember my answers

    i have a few aers whit my apple acount and i dntremember my answers for the security question and i dont know how to recover it back or how can i change it please any help

    You need to contact Apple. Click here, phone them, and ask for the Account Security team, or fill out and submit this form.
    (91532)

  • HT204053 My husband and I got an iphone and I groofed up and used the same apple id for both phones, I need to know how to change his phone to his new apple id

    My husband and I got new phones which is the Iphone and I groofed up and set both of them to the same apple ID, how do I change his to his new apple ID and not mine?

    Welcome to the Apple Community.
    In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add it back using your updated details. (Settings > iCloud, scroll down and hit "Delete Account")

  • HELP!!!! The screen on my mac mini has shrunk and I don't know how it happened and need to know how to change it back. It's really small print and it's hard for me to read.

    Please help!!! My compter screen has shrunk and the print is really hard to read. I don't know what I did to make this happen, but I'd really like to change it back to the larger size. Thanks for helping!

    Click on the Apple logo in the upper-left corner of your display.
    Click "System Preferences," then click "Displays."
    Click "Display" if it is not already selected.
    Select a resolution from the list of available resolutions. The most common screen resolution is 1280 by 1024 for standard screens and 1280 by 800 for wide screens as of February 2012
    Depending of the monitor you have.

  • I need to know about date function in Java

    Hi All,
    Here is my question - I need to subract 18 months from a particular date. How do I do that using Java coding?
    eg: 09/30/2003 - 18 months = 03/30/2002
    I have to to code this in Java in order to use it in one of my application. I would appreciate your help.
    Thanks & Regards
    Simly

    Hi There,
    Thank you for your reply...Need some more help...
    This is the case I want to deal with. I need to calculate the value for the field called "mydate"
    These are the three dates, I am going to deal with:
    1.olddate = I have a value for it -> eg: 05/12/1998
    2.today = Today's date -> eg: 09/30/2003
    3.newdate = today.month - 18 months -> eg: today.month =09-18=03/30/2002
    These are the three dates values.
    Now what I need to do is,
    If olddate(05/12/1998) > newdate (03/30/1998)
    then "mydate" = newdate -> 03/30/2002
    Else "mydate" = olddate -> 05/12/1998
    I am a good C++ programmer & a student and I am right now learning all the Java packages. I am having the greatest problem with the calcuation of value to the variable "new date". And also with the "If condition statement". I am aware of the before, after, getMonth methods. But, I am having problem in using them in this case. Could you please give me the exact coding for the declaration of the variables and the value calculation(in this specific case). I would appreciate your time and help.
    Thanks & Regards
    Simly

  • I need to know how to change default browser for my desktop icloud apps to open with.

    I like to use the desktop icloud apps, but when i use them, they open with IE when my default browser I like to use is Chrome. Is there a way to make it open with Chrome when I open Calendar or iCloud from my desktop instead of IE?
    thankyou for your help in advance!

    Ed...maybe a little less time gaming and a bit more time in English class? They got this thing called punctuation and sentences now. Last things first; there is no amount of money that can change your GPU so you can scratch that expense off the list. So you need a battery and a fan? Where do you live? USA? We can help you find a battery but where did you plan to have the new fan put in? 

  • Server change name and need to know where to change the configuration

    Hi all,
    Want to check that if the web application and the database server has change the server name what we need to change in the BO app and also data intergrator edge xi3.1. Hope someone can assist me on this so that i won't need to re-install  BO edge with data intergrator again. I cannot find any information anywhere that would inform me where to change. I really need it urgently.
    Regards,

    This is something that has plagued BusinessObjects Edge/Enterprise admins for a while--you can't change the server name for BusinessObjects XI 3.1 once it has been installed. There were some forum posts going around, with people trying with limited success but given the range of products and technologies in BusinessObjects (CR, Webi, Voyager, Xcelsius, QaaWS, Explorer, etc.) the server name is embedded in too many places to be able to successfully change the name. Your best bet would be to install BOE on a new server with the correct name then use the Import Wizard to swing the content over.
    On the Data Integrator front, you could probably rename the server and then delete and recreate your DI Job Server-- most of the meta data for DI is stored in the local repository database, so you may have a shot. I would definitely test this theory out on a development machine before trying it in a production environment!!

  • My partner has been given an iphone 4 from her father, I have manged to delete and move to her email but need to know how to change the phonebook i.e delete it and change the apple i.d...any ideas?

    Hi All
    My Partner has been given an ipone 4 from her father.
    I have managed to delete his email and set hers up, what I need to do is delete his contacts entirley..would this be able to be done if she connected her ipone to the computer and made herself an apple I.D or is it a matter of reset ?
    Also some pictures on the phone she would like to keep..
    Many thanks

    If her contacts are available in an Address Book app on her computer that is supported for syncing with the iPhone, she can select the supported address book app on her computer under the Info tab for her iPhone sync preferences for syncing contacts. She should be provided a merge prompt or replace the contacts on her iPhone with what is available in the address book app on her computer. Select the 2nd option.

  • HT5624 I need to know hw to change my security as iv forgotten it to an alt e mail

    How can I reset security by sending it to an alt email

    Reset security questions
    http://support.apple.com/kb/HT5312
    If you do not have a Rescue email, you need to call/email apple support, they will guide you through the process of resetting your security questions.
    https://ssl.apple.com/emea/support/itunes/contact.html
    http://support.apple.com/kb/HE57

Maybe you are looking for

  • No sound on youtube with safari

    No sound on youtube it plays the video but with no sound.

  • As the creator of an interactive PDF form, can I block users from opening it in Preview or web?

    I have created a number of interactive PDF application forms which are downloaded from our website and completed by individuals and organisations who wish to apply for funding. Increasingly we are being contacted by people who are having trouble comp

  • ISE 1.3 - Multiple ADs and time zone

    Hi all, I have a question regarding time zone settings, AD interaction and ISE PSN. Assuming the following deployment: - ISE distributed deployment with 3 - Each PSN is joined to a AD at a specific site (example: one in USA, one in Europe, one in Asi

  • Configure security BEFW11S4

    I need to re-configure the security for this router and my new adapter, after everything had to be re-set. The password I had setup for 192.168.1.1 doesn't let me into the setup page. Because the router is out of warranty, tech support says i have to

  • ISE after power off !!

    Hi everyone, I have ISE VMWare based. Every time, when I switch the power of the server off for any reason, and turn it on again, I lose the connectivity through HTTP to the ISE but I can still ping it !!!! I couldn't know what was the issue and for