-
1. Re: Why is this handler called 3x?
JackHombre Feb 28, 2012 7:08 AM (in response to JackHombre)And I'm using Flex 3.5 and Adobe Flash Builder 4.0.1
-
2. Re: Why is this handler called 3x?
JackHombre Feb 28, 2012 8:19 AM (in response to JackHombre)I've come to understand the problem a bit better: it seems that when I edit the cell, then push enter, save() gets called 3x and one of those times has event.reason == "newRow". If after editing the cell I click somewhere outside the cell, then save() gets called twice, and both times event.reason == "other". Oh yeah, and when I push enter, the event.target seems to be for the cell below.
By now I feel that my problem is that I just don't know what I'm doing. The handler gets called a bunch of times and I have no idea how to know why it's being called or if I should ignore what. I was hoping that combinations of calls to:
event.stopImmediatePropagation();event.stopPropagation();Would work (the idea is that I stop all these parasitic calls) but they don't do anything. I've read tutorials and such, but they don't seem to help me w/this problem.
-
3. Re: Why is this handler called 3x?
Flex harUI Feb 28, 2012 11:33 AM (in response to JackHombre)Maybe an issue with a custom renderer/editor? If you use default renderer/editor does it still get called multiple times?
-
4. Re: Why is this handler called 3x?
JackHombre Feb 28, 2012 1:48 PM (in response to Flex harUI)Not sure how to answer that. The declaration of the column is as follows:
<mx:DataGridColumn headerText="Value" dataField="parm_value" itemEditor="DataEditor" editorDataField="newData" sortable="false" />
Now, DataEditor.mxml will create a different control, depending on which row on the grid is involved, some of which are custom and others are mx:ComboBoxes or mx:TextInputs or whatever. I just ran some tests, and it seems they behave the same with primitive controls as they do with user-defined ones.
The solution I have in place now sets a flag, which causes the handler (save()) to return immediate, if it is set. I can do this, because the handler throws up an Alert.show(), confirming that the user wants to commit the change. Then, I reset the flag in Alert.show()'s handler. I suppose, the only race condition here could be that the user might be so johnny-on-the-spot that he'd confirm before the other calls to save() could be made, thereby resetting the flag early. As far as I know, that's not impossible. (But as far as I know, the call to Alert.show()'s hander gets put into a queue, behind the other calls to save()) In any case, this is obviously not a generally acceptable solution, and if there isn't one, then someone should be shot.
-
5. Re: Why is this handler called 3x?
Flex harUI Feb 28, 2012 1:58 PM (in response to JackHombre)The column has a custom editor defined in DataEditor.mxml. The entire grid has an itemEditEnd handler. If there is another column without a custom editor, does it exhibit the same problem? Or reconfigure this column to use the default editor. That will help determine if the problem is in DataEditor.mxml
If DataEditor.mxml is a container of an actual editable control, it should properly implement IFocusManagerComponent otherwise you might see symptoms as you have described.
Feel free to post the code for DataEditor.mxml
-Alex
-
6. Re: Why is this handler called 3x?
JackHombre Feb 28, 2012 2:19 PM (in response to Flex harUI)There's only one editable column on this screen. I don't really know how to make it use the default editor properly. If I remove the itemEditor="DataEditor" then I just get crashes all over the place when editing finishes.
I wouldn't say DataEditor.mxml is a control, but here's the Flex from that file (I won't inundate you w/the AS):
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
implements="mx.core.IDataRenderer, mx.controls.listClasses.IListItemRenderer"
xmlns:UBIComponent="assets.UBIComponent.*">
...
<mx:FormItem visible="false" > <UBIComponent:ubiComboBox id="cmbExplct" /> <UBIComponent:ubiComboBox id="cmbDateFormat" /> </mx:FormItem> </mx:Canvas>
-
7. Re: Why is this handler called 3x?
Flex harUI Feb 28, 2012 2:31 PM (in response to JackHombre)That implies that there are multiple editable fields in the renderer. This post may help: http://blogs.adobe.com/aharui/2008/08/datagrid_itemeditor_with_two_i.html


