Posted 14 September 2017, 2:08 am EST
Thanks for sending the sample app.
The attachment contains minor modifications needed to make it work. Basically, there are a couple of ways to add items to bound collections:
- CollectionView.addNew()
The “addNew” method does not take any parameters. It creates the new item, adds it to the collection, and returns a reference to it. When you are done initializing the new item, call “commitNew” to re-enable sorting/grouping/filtering on the new item.
For example:
var item = cv.addNew();
item.Name = ‘New Item’;
cv.commitNew();
This is the same behavior/syntax as .NET’s IEditableCollectionView.AddItem.
- array.push(item)
You can simply add items directly to the source collection, then call CollectionView.refresh to refresh the view and notify any listeners:
var item = { Name: ‘New Item’ };
cv.sourceCollection.push(item);
cv.refresh();
- ObservableArray.push(item)
If your array is observable, you can simply add items to it and it will issue the required notifications. For example:
var arr = new wijmo.collections.ObservableArray();
var item = { Name: ‘New Item’ };
arr.push(item);
I hope this clarifies things.
2014/09/WijmoAngularExample2.zip