属性是这种形式的对象:
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 的属性...
为什么我无法从属性中获取数据?到底是怎么回事?