Breeze:complextype的数组是空的或字符串

时间:2015-07-17 11:20:41

标签: breeze

我有一个entityType.product,其dataProperty为complexType。在这个complexType中,我有一个Ids的属性。提交表单时,要么提交字符串,要么我将complexType的属性Id设置为" isScalar:false"我会得到一个空数组。

如何获取数组中的字符串?

entityType.product:

createInstance: function createInstance(type, data) {
                var metadataStore = this.entityAspect.entityManager.metadataStore;

                return metadataStore.getEntityType(type).createInstance(data);
            }
,addNewMedia: function addNewAttribute(dataContext) {
                var newMedia = this.createInstance('MediaList');
                newMedia.isNew = true;
                this.mediaList.getMediaObjects().push(newMedia);
                return newMedia;
            },
 });

complexType.mediaList

dataProperties: {
                    /**
                     * @property mainObjectId
                     * @type {String}
                     */
                    mainObjectId: {
                        dataType: DataType.String
                    },
                    /**
                     * @property mediaObjectIds
                     * @type {String}{Array}
                     */
                    mediaObjectIds: {
                        dataType: DataType.Undefined
                    },

JSON:

    "dataSource": {
                "structure": {
                    "mainEntity": {
                        "entity": "Product",
                        "relatedEntities": ["MediaObject"]
                    },
                    "mediaObjects": {
                        "entity": "MediaObjects"
                    }
                }
            },
...
 "ngRepeat":"mediaObject in mcData.mainEntity.mediaList.getMediaObjects()",
...
"model": "mcData.mainEntity.mediaList.mediaObjectIds",

0 个答案:

没有答案