Flex中如何给DataGrid控件的项目添加一个可编辑TextArea/TextInput,单击控件内的项目时,自动进入编辑状态

main.mxml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml"
  3. layout="vertical"
  4. verticalAlign="middle"
  5. backgroundColor="white">
  6. <mx:XMLid="itemsXML" source="data/items.xml" />
  7. <mx:DataGridid="dataGrid"
  8. dataProvider="{itemsXML.item}"
  9. variableRowHeight="true"
  10. editable="true"
  11. width="100%"
  12. height="100%">
  13. <mx:columns>
  14. <mx:DataGridColumnid="idColumn"
  15. dataField="@id"
  16. editable="false"
  17. headerText="ID"/>
  18. <mx:DataGridColumnid="descColumnTextInput"
  19. dataField="@desc"
  20. editable="true"
  21. wordWrap="true"
  22. headerText="Desc (TextInput)"/>
  23. <mx:DataGridColumnid="descColumnTextArea"
  24. dataField="@desc"
  25. editable="true"
  26. wordWrap="true"
  27. itemEditor="mx.controls.TextArea"
  28. editorUsesEnterKey="true"
  29. headerText="Desc (TextArea)"/>
  30. </mx:columns>
  31. </mx:DataGrid>

items.xml

  1. </mx:Application>
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <items>
    3. <itemid="1" desc="The quick brown fox jumped over the lazy dog." />
    4. <itemid="2" desc="Lorem ipsum dolor sit amet, consectetuer adipiscing elit." />
    5. <itemid="3" desc="Pellentesque nonummy aliquet metus." />
    6. <itemid="4" desc="Nullam enim." />
    7. <itemid="5" desc="Nullam sollicitudin sodales diam." />
    8. <itemid="6" desc="Praesent quis tellus vel erat tristique placerat." />
    9. <itemid="7" desc="Sed egestas, enim a convallis auctor, nisl tellus tincidunt nibh, vitae tempus mauris risus at arcu." />
    10. <itemid="8" desc="Suspendisse laoreet sem eget ipsum porta consequat." />
    11. <itemid="9" desc="Ut imperdiet felis quis orci." />
    12. <itemid="10" desc="Phasellus tempus ante eu nisl." />
    13. <itemid="11" desc="Donec velit sem, rutrum ac, bibendum sed, mattis ac, odio." />
    14. <itemid="12" desc="Fusce mauris turpis, vehicula nec, mattis et, dapibus quis, arcu." />
    15. <itemid="13" desc="Morbi tincidunt volutpat justo." />
    16. <itemid="14" desc="Nam urna." />
    17. <itemid="15" desc="Mauris est dui, aliquet at, venenatis tempus, eleifend a, pede." />
    18. <itemid="16" desc="Vestibulum porttitor arcu sit amet nulla." />
    19. <itemid="17" desc="Nulla vitae sapien." />
    20. </items>

你可能感兴趣的:(xml,Flex,Adobe)