The colorpicker I was talking about is the one inside the rich text editor. so first, I select the cell -> the richTextEditor pops (as expected because is the itemEditor), then I select some text, the I select the color picker to change the text selection color but (here is the problem), the text editor hides and I can select a color, but as there's no RichTextEditor the color change fails.
So...how can I maintain the RichTextEditor and be able to change the color of some text with the color picker?
Thanks Joan for taking the time :)
C.
Hi Joan,
I try to modify the example that I've posted before but I can't get it work without
throwing that error. Could you modify the example in order to get it work without the
text getter workaround in order to understand it well?.
Thanks in advance.
C.On 8/5/06, Joan Lafferty < [EMAIL PROTECTED]> wrote:
The reason you get the error "there's no text property in the inline editor..." is because an itemEditor is always looking for the "text" property in your itemEditor to update your dataProvider with. So, if your editor was a Text, TextArea, or TexInput, then, this would work. In other cases where your itemEditor doesn't have a text property, you have to specify an editorDataField.
Here is one example of using a colorPicker as an itemRenderer.
<!---main.mxml --à
<?xml version="1.0"?>
<!-- complexDGEditorReturnObject.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="700" >
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var initDG:ArrayCollection = new ArrayCollection([
{ Flower: 'Roses', Color: 0xFF0000 },
{ Flower: 'Gerber Daisies', Color: 0x00FF33} ]);
]]>
</mx:Script>
<mx:TextArea id="mytext" />
<mx:DataGrid id="myGrid" variableRowHeight="true" dataProvider="{initDG}" editable="true" >
<mx:columns>
<mx:DataGridColumn dataField="Flower" />
<mx:DataGridColumn dataField="Color" itemRenderer="ColorPickerComp" editorDataField="newColor"
rendererIsEditor="true"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
<!----- ColorPickerComp.mxml - à
<?xml version="1.0" encoding="utf-8"?>
<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*">
<mx:Script>
public var newColor:Number;
</mx:Script>
<mx:Binding source="cp.selectedColor" destination="newColor" />
<mx:ColorPicker id="cp" selectedColor="{data.Color}" />
</mx:Box>
Hope this helps.
Joan
From: [EMAIL PROTECTED] ups.com [mailto: [EMAIL PROTECTED] ups.com] On Behalf Of Carlos Rovira
Sent: Friday, August 04, 2006 4:12 PM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] [Flex 2][RichTextEditor] How to use a RichTextEditor as itemEditor in DataGrid
After a lot of test I get a cell in a datagrid with an inline Text Control for itemRenderer and a RichTextEditor for
itemEditor. I try drop-in itemEditor and itemRenderer but I can't get it work...This is my solution:
<mx:DataGridColumn dataField="tema"
headerText="Tema" width="330"
editorWidthOffset="200" editorHeightOffset="200"
editorUsesEnterKey="true">
<mx:itemRenderer>
<mx:Component>
<mx:VBox width="300" height="200">
<mx:Text htmlText="{ data.tema}" width="100%" height="100%"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
<mx:itemEditor>
<mx:Component>
<mx:VBox width="300" height="200">
<mx:RichTextEditor id="rie" htmlText="{ data.tema}" headerHeight="0"/>
<mx:Script>
<![CDATA[
public function get text():String {
return rie.htmlText;
}
]]>
</mx:Script>
</mx:VBox>
</mx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
You can see a getter for a text property. This is necesary because it seems to be a bug when you use a RichTextEditor as an inline itemEditor, the player complains that "there's no text property in the inline editor...". So that's the solution...
Now I'm facing a problem with the color picker...I can't get the selected text change with a color selection (in case that I don't lose the focus on the color picker).
Someone knows the way to get the color picker works?
Thanks :)
--
::| Carlos Rovira
::| http://www.carlosrovira.com
--
::| Carlos Rovira
::| http://www.carlosrovira.com
--
::| Carlos Rovira
::| http://www.carlosrovira.com __._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
![]()
SPONSORED LINKS
Web site design development Computer software development Software design and development Macromedia flex Software development best practice
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
Reply via email to

