app/actions/addAction/addAction.js
function() {
        var editDataSource = this.getProperty( 'editDataSource' );
        var destinationDataSource = this.getProperty( 'destinationDataSource' );
        var destinationProperty = this.getProperty( 'destinationProperty' ) || '';

        if( !destinationDataSource ) {
            return;
        }

        if( this._isObjectDataSource( editDataSource ) ) {
            var newItem = editDataSource.getSelectedItem();

            if( this._isRootElementPath( destinationProperty ) ) {
                destinationDataSource._includeItemToModifiedSet( newItem );
                destinationDataSource.saveItem( newItem, function() {
                    destinationDataSource.updateItems();
                } );
            } else {
                var items = destinationDataSource.getProperty( destinationProperty ) || [];

                items = _.clone( items );
                items.push( newItem );

                destinationDataSource.setProperty( destinationProperty, items );
            }
        } else {
            destinationDataSource.updateItems();
        }
    }
function() {
        var editDataSource = this.getProperty( 'editDataSource' );
        var destinationDataSource = this.getProperty( 'destinationDataSource' );
        var destinationProperty = this.getProperty( 'destinationProperty' ) || '';

        if( !destinationDataSource ) {
            return;
        }

        if( this._isObjectDataSource( editDataSource ) ) {
            var newItem = editDataSource.getSelectedItem();

            if( this._isRootElementPath( destinationProperty ) ) {
                destinationDataSource._includeItemToModifiedSet( newItem );
                destinationDataSource.saveItem( newItem, function() {
                    destinationDataSource.updateItems();
                } );
            } else {
                var items = destinationDataSource.getProperty( destinationProperty ) || [];

                items = _.clone( items );
                items.push( newItem );

                destinationDataSource.setProperty( destinationProperty, items );
            }
        } else {
            destinationDataSource.updateItems();
        }
    }
function ( ) { var editDataSource = this . getProperty ( 'editDataSource' ) ; var destinationDataSource = this . getProperty ( 'destinationDataSource' ) ; var destinationProperty = this . getProperty ( 'destinationProperty' ) || '' ; if ( ! destinationDataSource ) { return ; } if ( this . _isObjectDataSource ( editDataSource ) ) { var newItem = editDataSource . getSelectedItem ( ) ; if ( this . _isRootElementPath ( destinationProperty ) ) { destinationDataSource . _includeItemToModifiedSet ( newItem ) ; destinationDataSource . saveItem ( newItem , function ( ) { destinationDataSource . updateItems ( ) ; } ) ; } else { var items = destinationDataSource . getProperty ( destinationProperty ) || [ ] ; items = _ . clone ( items ) ; items . push ( newItem ) ; destinationDataSource . setProperty ( destinationProperty , items ) ; } } else { destinationDataSource . updateItems ( ) ; } }
Save item in destination data source
Save item in destination data source