Dashcode Web App: How to programmatically manipulate bound array in dataSource?

Posted by Kross on Stack Overflow See other posts from Stack Overflow or by Kross
Published on 2010-11-09T21:34:04Z Indexed on 2011/02/13 15:25 UTC
Read the original article Hit count: 243

Hi Everyone, I've started using Dashcode to write an interface for presenting the report data for some of our Cocoa tools. I am using a Dashcode data source and bindings to populate the elements in the WebView, and it all seems to be working well so far.

One of the objects in my dataSource is an array of objects that I would like to manipulate programmatically. I can change the object values in the array just fine but if I want to replace the array, or any objects in the array, my bound table isn't able to observe the added objects.

Here is the code that I thought would let me easily replace the bound array with new content:

var dataSource = dashcode.getDataSource("reportData");
var newDetailArray = testArray();
dataSource.setValueForKeyPath(newDetailArray, "content.detailArray");

But this throws the exception:

Exception while binding "content" to keypath "arrangedObjects " TypeError: Result of expression 'this.object.valueForKeyPath' [undefined] is not a function.

Is there something I'm missing that will let me easily manipulate the array's contents programmatically?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about databinding