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

  • SEARCH
  • Home
  • 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 6016533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:59:46+00:00 2026-05-23T02:59:46+00:00

I have a DataGrid which uses an itemRenderer to display the items in a

  • 0

I have a DataGrid which uses an itemRenderer to display the items in a DataGridColumn. The ItemRenderer is created in actionscript and contains the following code:

public class PromptingColumnRenderer extends Label {

    public function PromptingColumnRenderer()
    {
        super();
    }

    //When the data is empty, display the correct prompt
    override public function set data(newData:Object):void
    {
        super.data = newData;
        var value:String=data.value as String;
        var type:String=data.type as String;

        if (value=="") {
            this.setStyle("color","0x444444");
            this.setStyle("fontStyle","italic");
            if (type=="TEXT")
                this.text="Enter Text";
            else if (type=="NUMBER")
                this.text="Enter a Number";
            else
                this.text="Choose a Date";
        }
        else {
            this.setStyle("color","0x000000");
            this.setStyle("fontStyle","normal");
            this.text = value;
        }
    }
}

I set this as the ItemRenderer of my DataGridColumn with the following mxml:

<mx:DataGridColumn id="valueCol" 
            itemRenderer="com.x.x.x.PromptingColumnRenderer" 
            dataField="value" sortable="false" editable="true"/>

In this DataGrid column, I require number validation on only the data with the type=”NUMBER” field set. The problem is, when I try to declare a NumberValidator within my PromptingColumnRenderer actionscript code, the view recycles the renderer, and the NumberValidator attempts to validate non-numeric rows. What is the best way to validate only the rows with the type=”NUMBER” field set?

  • 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-23T02:59:46+00:00Added an answer on May 23, 2026 at 2:59 am

    Don’t validate within your itemRenderer. Instead create a custom itemEditor. That is the piece that is created when he user enters into the field to enter new value. I believe it uses a textInput by default. But, you could use a numeric stepper, or a TextInput w/ a numericValidator.

    Here is an article on itemRenderers.

    I believe that is the best approach, but if you prefer to stick with what you have, and validate within the itemRenderer, then just add a conditional to prevent validation if the entered value is not a number.

    Conceptually something like this:

    if(Number(this.text)){
     // run validator
    } else {
     // do nothing
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight DataGrid that contains a single template column which displays a
I have a datagrid whose itemsSource is bound to a multiconverter which uses a
I am working in vs2010. I have created a DataGrid which is bounded to
I have created a converter class that uses the IValueConverter interface and InConverter. It
I have a datagrid which gets data like this: public struct MyData { public
Picture the following scenario: I have a DataGrid which I've bound to a list
i have a DataGrid with FrozenColumnCount set to one and some DataTemplateColumns which contains
I have a datagrid which is populated with CSV data when the user drag/drops
I have a DataGrid which I am binding to a PagedCollectionView which is grouped
I have a DataGrid which is being bound dynamically to a database query. The

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.