Reputation: 4142
Attribute is an object in this form:
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
};
That attribute then gets passed to this function along with the ID of a grid:
function AddAttributeToGrid(attribute, gridId) {
console.log(attribute); //Works! Displays the attribute.
var id = a.attributeId;
console.log(id);//UNDEFINED? WHAT?
}
If I create a global variable (let's call it 'tempAttribute') and set it inside of AddAttributeToGrid, like so:
function AddAttributeToGrid(attribute, gridId) {
tempAttribute = attribute
}
I can then access the properties of tempAttribute...
Why can I not get the data from the properties? What is going on?
Upvotes: 0
Views: 53
Reputation: 382092
The property of attribute
is AttributeId
, not attributeId
.
JavaScript is case sensitive.
But this assumes you initialized your object with a defined attributeId
to start with. This is not clear in your code.
Upvotes: 3
Reputation: 27835
i think you have
var id = a.attributeId;
instead of
var id = attribute.AttributeId;
inside the AddAttributeToGrid
function definition
Upvotes: 1