Hello!
I'm getting a error with LCDS 3.1.0.315496
I'm using a DataService to edit some entities with
dataService.autoCommit = false;
I fill a arrayCollection like:
dataService.fill(entitiesAC); //fill with all entites
If i want to update a entity i do:
dataService.commit([entitiy]); //works fine
If i want to create a entity i do:
dataService.createItem(entity);
dataService.commit([entity]); //works fine
If i want to undo my made changes i do:
dataService.revertChanges( entity ); //works fine
If i want to delete a entity i do:
dataService.deleteItem( entity );
dataService.commit( [entity] );
In this case the entity will be deleted, but i get this ugly flex error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.data::DataList/getItemIndex()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:376]
at mx.collections::ListCollectionView/getFilteredItemIndex()[E:\dev\4.x\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:710]
at mx.collections::ListCollectionView/addItemsToView()[E:\dev\4.x\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1102]
at mx.collections::ListCollectionView/listChangeHandler()[E:\dev\4.x\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1284]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.data::DataList/internalDispatchCollectionEvent()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:2296]
at mx.data::DataList/internalDispatchOneAddRemoveEvent()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:2285]
at mx.data::DataList/http://www.adobe.com/2006/flex/mx/internal::applyUpdateCollectionRangeIndex()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:1920]
at mx.data::DataList/http://www.adobe.com/2006/flex/mx/internal::applyUpdateCollection()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:1703]
at mx.data::DataList/http://www.adobe.com/2006/flex/mx/internal::applyPendingUpdateCollections()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:1466]
at mx.data::DataList/http://www.adobe.com/2006/flex/mx/internal::processUpdateCollection()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataList.as:1634]
at mx.data::ConcreteDataService/http://www.adobe.com/2006/flex/mx/internal::processUpdateCollection()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\ConcreteDataService.as:4683]
at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::commitResultHandler()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\DataStore.as:2264]
at mx.data::CommitResponder/internalProcessResults()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\CommitResponder.as:559]
at mx.data::CommitResponder/processResult()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\CommitResponder.as:487]
at mx.data::CommitResponder/result()[C:\depot\DataServices\branches\hotfixes\lcds31_hotfixes\frameworks\projects\data\src\mx\data\CommitResponder.as:228]
at mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84]
at NetConnectionMessageResponder/resultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:547]
at mx.messaging::MessageResponder/result()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:235]
I don't get any error if i do
dataService.deleteItem( entity );
dataService.commit( ); //but this also will commit unsaved changes in other entities
Thanks for your help
Views
Replies
Total Likes
Can you try passing to the commit method, just the entity without putting it into an array? Also, do you have any associations from the deleted entity? If so, by default it will not cascade commit changes to associated items. See here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/data/DataManager.html#commit%2...
Views
Replies
Total Likes
Hi and thanks for your answer!
The entity is not associated with any other entities or contains any other entities ...
How should i pass the entity without putting it into an array, cause the commit mehod looks like:
public function commit(itemsOrCollections:Array = null, cascadeCommit:Boolean = false):mx.rpc:AsyncToken
I also tried cascadeCommit = true without changes ...
The confusing thing is, that the collectionEvent.kind is "add" with collectionEvent.items= [null] .... and it seems that the mx.data::DataList/getItemIndex is not null-safe ...
..... an open source code of LCDS would be nice
So any other ideas?
Thanks
Philip Mair
Views
Replies
Total Likes
Well i made a workaround for my problem:
protected function initializeHandler(event:FlexEvent):void
{
//at first fill, the entetiesAC.list will be set to a mx.data.DataList
numberRangeProxy.fill( entetiesAC );
//catch the CollectionEvent before the ListCollectionView.listChangeHandler gets the event
numberRangesAC.list.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionChangeHandler, false, int.MAX_VALUE, true);
}
protected function collectionChangeHandler(event: CollectionEvent) : void
{
if(event.kind == "add")
{
var i: int;
while((i=event.items.indexOf(null)) >= 0)
event.items.splice(i,1); //remove all null items
}
}
This works for me, but i think it is still a bug of LCDS and should be fixed!
Thanks
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies