Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 545069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:43:21+00:00 2026-05-13T10:43:21+00:00

A few hours ago I’ve asked how to create a custom component (textInput and

  • 0

A few hours ago I’ve asked how to create a custom component (textInput and label component and created a Component Definition) and with your answers I can do that now.

Problem 2: I’d like to use that component in a datagrid column so that the user can type a value in the textInput which will in turn update the underlying dataprovider.
I know I should use a cellrenderer like I’ve done with a checkbox column (also with help on the Net), but at this stage I’m only pulling my hair out.
Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:43:21+00:00Added an answer on May 13, 2026 at 10:43 am

    This might look messy as it’s a modified example.

    Make sure you have the DataGrid, Label and TextInput components in the library of the fla you want to try this:

    // Import the required component classes.
    import fl.controls.DataGrid;
    import fl.controls.dataGridClasses.DataGridColumn;
    import fl.data.DataProvider;
    //get some data ready, notice data and label
    var dp:DataProvider = new DataProvider();
    for(var i:int = 0 ; i < 7; i++)
        dp.addItem({data:'input '+(i+1),label:'label '+(i+1), title:"item " + (i+1)});
    var dataCol:DataGridColumn = new DataGridColumn("data");
    dataCol.cellRenderer = CustomCell;
    var titleCol:DataGridColumn = new DataGridColumn("title");
    
    var myDataGrid:DataGrid = new DataGrid();
    myDataGrid.addColumn(dataCol);
    myDataGrid.addColumn(titleCol);
    myDataGrid.dataProvider = dp;
    myDataGrid.rowHeight = 64;
    myDataGrid.width = 500;
    myDataGrid.rowCount = dp.length - 1;
    myDataGrid.move(10, 10);
    myDataGrid.editable = true;
    addChild(myDataGrid);
    

    And the CustomCell class looks like this:

    package {
        // Import the required component classes.
        import fl.controls.listClasses.ICellRenderer;
        import fl.controls.listClasses.ListData;
        import fl.controls.Label;
        import fl.controls.TextInput;
        import fl.core.InvalidationType;
        import fl.core.UIComponent;
        import fl.data.DataProvider;
        import flash.display.Sprite;
        import flash.events.Event;
    
        public class CustomCell extends UIComponent implements ICellRenderer {
            protected var _data:Object;
            protected var _listData:ListData;
            protected var _selected:Boolean;
            //the custom components
            private var labelComponent:Label;
            private var inputComponent:TextInput;
            /**
             * Constructor.
             */
            public function CustomCell():void {
                super();
                init();
            }
            /**
             * Draws the Label and TextInput components
             */
            private function init():void{
                labelComponent = new Label();
                labelComponent.autoSize = 'right';
                inputComponent = new TextInput();
                inputComponent.editable = true;
    
                addChild(labelComponent);
                addChild(inputComponent);
                inputComponent.x = labelComponent.width + 5;//5 pixels distance between components
                inputComponent.drawFocus(true);
            }
    
            public function get data():Object {
                return _data;
            }
            /** 
             * @private (setter)
             */
            public function set data(value:Object):void {
                _data = value;
                //there's label data, update the label
                if(_data.label) labelComponent.text = _data.label;
                //there's data for the input, update that too
                if(_data.data) inputComponent.text = _data.data;
            }
    
            public function get listData():ListData {
                return _listData;
            }
            public function set listData(value:ListData):void {
                _listData = value;
                invalidate(InvalidationType.DATA);
                invalidate(InvalidationType.STATE);
            }
            public function get selected():Boolean {
                return _selected;
            }
            public function set selected(value:Boolean):void {
                _selected = value;
                invalidate(InvalidationType.STATE);
            }
            public function setMouseState(state:String):void {
            }
    
        }
    }
    

    The code mostly comes from this devnet article.

    It works ok, as in, it’s editable.

    Solution is be a component class(a class extending fl.core.UIComponent), implementing the ICellRender interface so it can be set as a renderer, and containing the Label and TextInput components. Also data will be mapped to TextInput.text, so it can be easily edited.

    If DataGrid is a bit bloated, and you want to use the Component Definition or something simpler. I guess you can hack together a solution using a List and setting a custom cellRenderer using styles.
    I’m guessing custom clips are used as a cell renderer in the Plugins list on the tweenlite page.

    HTH,
    George

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 389k
  • Answers 389k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When you need to use quoting (quote(), quoteInto()) with Zend_Db_Table:… May 15, 2026 at 12:37 am
  • Editorial Team
    Editorial Team added an answer IF the pattern is always xxxxx_anythingelse.txt then you could parse… May 15, 2026 at 12:37 am
  • Editorial Team
    Editorial Team added an answer COUNT(expression) will count all rows where expression is not null.… May 15, 2026 at 12:37 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.