0

Just FYI this code is part of ExtJS 4 script. I have a global setting which I use to show the path to the dir where my icons are. I'm making some modifications so before was:

g_settings.iconUrl

but now I need to pass a third argument property like this:

g_settings.iconUrl.docIcon

The problem I met is where I have an if statement where I check for different values:

if (extensions == 'doc'||extensions == 'docx'||extensions == 'xlsx'||extensions == 'xls)

and then I do:

extensions += 'Icon';

and I need to use:

g_settings.iconUrl.extension

when I use console.log(extensions) it's value is as expected (for example docIcon) but when I try to use it as a property it doesn't work. If I use console.log on:

console.log(g_settings.iconUrl+ '.' +extensions)

the output is [object Object].docIcon so I think I have to convert somehow extensions to object too. I'm not sure that this will solve the problem but that's what I have for now.

Any suggestions?

Thanks

Leron

2
  • Was g_settings.iconUrl a string before? Commented May 23, 2012 at 10:13
  • the output is [object Object].docIcon -> this is in my main post. I think that this means that those two were objects. Correct me if i've read the console.log output wrong way. Commented May 23, 2012 at 10:31

2 Answers 2

1

Why not just add it to the string..

console.log("g_settings.iconUrl." + examples)

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

Comments

0

iconURL was (and probably still is) a string, but then you added some properties... so on the assignment of .iconURL="..." you should use

iconURL.file="...";//(or other name you choose)

and latter use

.iconURL.file+"."+extensions;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.