屬性是這種形式的對象:爲什麼此對象的屬性未定義? JavaScript的
var attribute = {
AttributeId: attributeId,
EntityId: entityId,
AttributeDBName: attributeDbName,
AttributeDisplayName: attributeDisplayName,
IsSearchable: isSearchable,
IsDeleted: isDeleted,
IsVisible: isVisible,
AttributeTypeId: attributeTypeId,
Description: description,
IsSystem: isSystem,
IsActive: isActive,
IsUnique: isUnique,
IsRequired: isRequired,
IsPersistent: isPersistent,
DefaultValue: defaultValue
};
該屬性然後被傳遞給這個函數與網格的ID一起:
function AddAttributeToGrid(attribute, gridId) {
console.log(attribute); //Works! Displays the attribute.
var id = a.attributeId;
console.log(id);//UNDEFINED? WHAT?
}
如果我創建一個全局變量(姑且稱之爲它tempAttribute「),把它AddAttributeToGrid內,像這樣:
function AddAttributeToGrid(attribute, gridId) {
tempAttribute = attribute
}
然後我就可以訪問tempAttribute的屬性...
爲什麼我無法從屬性中獲取數據? 發生了什麼事?
Omg。我無法相信我錯過了...... LMFAO! 謝謝:) – pookie