4 Replies Latest reply on Mar 8, 2007 9:13 AM by TucsonJava

    ItemEditor activate issue

    TucsonJava Level 1
      I have an itemEditor that extends TextInput. It works as expected until I enter a zero in the editor. After that I cannot get the editor to 'activate' again. I have trace statements at the start of the constructor and the set data function. Nothing shows up once the zero gets entered. I cannot tab into the field or click into it either.

      Has anyone seen this type of behavior before?
        • 1. Re: ItemEditor activate issue
          ntsiii Level 3
          No. Can you post a simple example?
          • 2. Re: ItemEditor activate issue
            TucsonJava Level 1
            I'll try to make a simple example. The problem is the component this happens in is fairly complex and probably contributes to the issue in some unforeseen way. However, I'll see if I can come up with a simple example to illustrate the issue.
            • 3. Re: ItemEditor activate issue
              ntsiii Level 3
              Ok, and actually, you will probably find that that exercise exposes the cause of the problem you are having.

              • 4. Re: ItemEditor activate issue
                TucsonJava Level 1
                Well, you are so right. The example I came up with was simpler than the current component but still too complex to post. However, I did manage to solve the problem, although I am not sure which change made the big difference. For the sake of anyone else that might run into a similar problem, I'll post my the changes I made.

                I have both custom renderers and custom editors for several of the columns of a grid. All were written in AS and extended TextInput. I'm not sure where I got my original idea of how they should be written but I believe it was somewhere in the Adobe Developer's Guide. Anyway, here's a sample renderer and then editor with comments on what was added and what was removed. Hope it helps someone else.

                // render's overridden set data
                override public function set data(value : Object) : void{
                // Setting data previouly with actual value of field. Changed to set value of the row
                // super.data = OrderItem(value).amountOrdered; // **REMOVED
                super.data = OrderItem(value); // **ADDED
                text = String(OrderItem(value).amountOrdered);
                // Used the invalidatedDisplayList earlier but changed to displayEvent
                // super.invalidateDisplayList(); // **REMOVED
                dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); // **ADDED

                // editor's overridden set data
                ... (application specific stuff unchanged)
                //super.data = value; // ** REMOVED. I no longer set data
                //super.invalidateDisplayList(); // ** REMOVED. Use the dispatchEvent instead
                dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); // ** ADDED

                The editor also used to set a Change listener in the constructor and handle data change events it self. This was removed also.