0

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?

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Omg. I can't believe that I missed that... LMFAO! Thanks :)
1

i think you have

var id = a.attributeId; 

instead of

var id = attribute.AttributeId; 

inside the AddAttributeToGrid function definition

1 Comment

Close :) Turns out it was just a damn capitol letter instead of lowercase!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.