Skip to Content
author's profile photo Former Member
Former Member

Issues when writing data to Excel with InputBindings

Hi Gurus,

I'm working on my first Xcelsius custom component. I want to use the component to change a specified cell in a range in Excel. I set the propertyName "Target" in propertySheet and bind with:

proxy.bind(propertyName,  null, bindingID, BindingDirection.BOTH, InputBindings.ARRAY2D, OutputBindings.ARRAY2D);

In AS file, I wrote getter and setter for property "Target":

		[Inspectable(type="Array")]
		public function get Target():Array
		{
			return _target;
		}
		
		[Bindable]
		public function set Target(value:Array):void
		{
			_target = value;
		}

When I change the cell in Array, if I write in these ways, it does not work:

		_target<i>[j] = newValue;
		this.Target = _target;
		this.Target<i>[j] = newValue;
		var tempTarget:Array = _target;
		tempTarget<i>[j] = newValue;
		this.Target = tempTarget;

Only if I write in this way, I can change the target range:

		var tempTarget:Array = new Array();
		for (var i:int = 0; i < _target.length; i++)
			tempTarget.push(_target<i>);
		tempTarget[row][col] = newValue;
		this.Target = tempTarget;

My questions is:

1. I want to know why those 3 ways do not work;

2. If I change the whole target range (maybe 500 * 30) in the way of last one, will it lead to a performance issue? Can I modify only one cell instead of the whole range?

Thanks!

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2011 at 10:22 PM

    Hi Edwin,

    Bindings do not work the same way for Arrays in Flex, see Cannot make an Array set function Bindable in the xcelsius2008_componentsdk_release_notes.pdf which has this example.

    You need to send an event to say the array was changed, so in this example call: notifyChartDataInputChanged.

    public function set chartDataOutput(val:Array):void
    {
        // ...
    }
    
    [Bindable ("propertyChange")]
    public function get chartDataInput():Array
    {
        // ...
    }
    
    /**
    * Example of how to notify when the "chartDataInput"
    * property changes.
    */
    public function notifyChartDataInputChanged():void
    {
        var event:Event = PropertyChangeEvent.createUpdateEvent(this, "chartDataInput", null, chartDataInput);
        dispatch(event);
    }

    Regards

    Matt

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.