Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

calling itemEditEndHandler from a function

Posted on 2011-09-07
4
560 Views
Last Modified: 2012-05-12
hi guys

I have a requirment, been trying hard to solve this.

In my appliaction the following functions are called



private function buildColumn(headers:Object,fields:Object):void{
 dataGrid.addEventListener(flash.events.KeyboardEvent.KEY_UP,createAutoPopulate);
dataGrid.addEventListener(AdvancedDataGridEvent.ITEM_EDIT_END,itemEditEndHandler);
            }

private function createAutoPopulate(event: flash.events.KeyboardEvent) : void {      
PopUpManager.addPopUp(dataGrid, this, false);      //show data            
tradeLookUp.dataGrid.addEventListener(CheckBoxEvent.CHECKBOX_TOGGLED,populatedata);
dataGrid.addEventListener(MouseEvent.CLICK,closepopupOnouterGridClick);
}

private function itemEditEndHandler(event:AdvancedDataGridEvent):void{
if(event.currentTarget.columns[event.columnIndex].editable){
..code
   }
}

private function populatedata ( event:CheckBoxEvent ) : void {
soeIdtoDisplay = event != null && event.data != null ? event.data.userId : "";
From here i want to call itemEditEndHandler()  and pass the AdvancedDataGridEvent.
any idea how i can do that?
                  
//AdvancedDataGridEvent evnt =  ??
//      itemEditEndHandler(evnt);
                  
}

 
0
Comment
Question by:royjayd
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 36499889
If you are extended an itemRenderer you should able to dispatch and event.
I need full code

var advancedDataGridEvent:AdvancedDataGridEvent =
            new AdvancedDataGridEvent(AdvancedDataGridEvent.ITEM_EDIT_END, false, true);        advancedDataGridEvent.columnIndex = listData.columnIndex;
advancedDataGridEvent.dataField = listData.dataField;
advancedDataGridEvent.rowIndex = listData.rowIndex;
advancedDataGridEvent.itemRenderer = this;
 advancedDataGridEvent.reason = AdvancedDataGridEventReason.CANCELLED;
dispatchEvent(advancedDataGridEvent);

0
 
LVL 37

Expert Comment

by:zzynx
ID: 36527658
>> tradeLookUp.dataGrid.addEventListener(CheckBoxEvent.CHECKBOX_TOGGLED, populatedata);
I find the above instruction looking strange, uncommon: You listen on a DataGrid for CheckBoxEvent's.
No offense meant, but isn't that weird?
Maybe you have to rethink your design. Can you explain it to us?
0
 

Author Comment

by:royjayd
ID: 36529267
>>No offense meant, but isn't that weird?
why?
The datagrid contains a checkbox column. when checkbox in each row is checked or unchecked i am calling populatedata function.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 36529484
I would expect that checking/unchecking the checkbox editor, changes your datagrid data.
That is something you can listen for.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Converting PDF to SWF with video embedded 11 458
Refresh Image 2 30 949
change color row in datagrid 6 648
Adobe Flex - Combobox - Disable Editing 15 815
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Starting your own business is always a daunting process, and for most people it is brand new experience. Avoid the common pitfalls by following these tips to start on the road to success.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question