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 7000297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:39:09+00:00 2026-05-27T20:39:09+00:00

I have a datagrid that allows user to change and save columns widths and

  • 0

I have a datagrid that allows user to change and save columns widths and visibility. I’d like to add a reset button that would just reset the datagrid to it’s original mxml. This is the original datagrid code.

<mx:DataGrid x="10" y="47" height="159" width="250" dataProvider="{acOffspring}" id="offspring_dg">
    <mx:columns>
        <mx:DataGridColumn headerText="Tag" visible="true" dataField="animal_ptag" width="121"/>
        <mx:DataGridColumn headerText="Sex" dataField="animal_sex" width="45"/>
        <mx:DataGridColumn headerText="Birth Date" visible="true" dataField="animal_birthdate" width="82"/>
        <mx:DataGridColumn headerText="Name" visible="false" dataField="animal_name" width="82"/>
        <mx:DataGridColumn headerText="Status" visible="false" dataField="status_status" width="82"/>
        <mx:DataGridColumn headerText="Breed" visible="false" dataField="breed_breed" width="82"/>
    </mx:columns>
</mx:DataGrid>
  • 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-27T20:39:10+00:00Added an answer on May 27, 2026 at 8:39 pm

    You have two options that I see:

    The first is to destroy the component and create a new instance of it. Like this:

    container.removeChild(offspring_dg);
    offspring_dg= new myDataGrid();
    container.addChild(offspring_dg);
    

    The second is to store the default values in some manner and then do a loop and reset all the relevant properties. Something like this:

    Column1InitialWidth = offspring_dg.columns[0].width
    Column1InitialVisibility = offspring_dg.columns[0].visibility
    etc... 
    

    When it comes time to reset them just do the same thing in reverse:

    offspring_dg.columns[0].width = Column1InitialWidth
    offspring_dg.columns[0].visibility = Column1InitialVisibility 
    

    I’m sure this approach could be encapsulated a bit more if you’re dealing with a lot of columns.

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

Sidebar

Related Questions

I have a datagrid that I want to add a button/s to at runtime.
Using .NET 1.1, I have a DataGrid that contains three columns for each row.
I have a DataGrid component that displays a few columns of data. It has
I have a custom dataGrid that acts more like a 2D list (if that
I have a SL DataGrid that has two columns. I need to be able
I have a DataGrid that has between 4-10 columns. I want the columns to
I have a web application that allows a user to search on some criteria,
I have a ASP.NET GridView that uses template columns and user controls to allow
I have written a c# win forms application that allows the user to open
I have a Silverlight datagrid that allows the use to enter in how many

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.