Solved

calling itemEditEndHandler from a function

Posted on 2011-09-07
4
552 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
Comment Utility
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
Comment Utility
>> 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
Comment Utility
>>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
Comment Utility
I would expect that checking/unchecking the checkbox editor, changes your datagrid data.
That is something you can listen for.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now