3

I want to list all members of a qooxdoo object. I found a way to do it, but I assume there must be a cleaner way?

for (var key in obj) {
  if (key.startsWith('$$user_')) {
    msg += 'name='+key.substring(7)+' = '+obj[key]+' [type='+typeof(obj[key])+']';
  }
}          
Remi Arnaud
  • 465
  • 1
  • 4
  • 11

1 Answers1

4

Assuming it is properties you are interested in, you can use

var classProperties = qx.util.PropertyUtil.getAllProperties(obj.constructor);
for(var propertyName in classProperties) {
    ...
}

http://tinyurl.com/c4b2l5m

geonik
  • 181
  • 7
  • You can simply use the 'get' method [1] every object offers and access their values. [1] http://demo.qooxdoo.org/current/apiviewer/#qx.core.MProperty~get – Martin Wittemann Nov 28 '12 at 07:56