I have a model trader defined as an object, and a session store called trader which if of type 'trader'.
I want to loop through the object items in javascript, how is this accomplished?
Hello Terry,
Please use for..in statement for that: https://developer.mozilla.org/en/docs...
Thanks, Sergiy,
I have it working now here is the solution to my issue of checking completeness of a trader profile:
//this indicates how complete a profile is:
//There are 20 profile items, so for every completed item
//we add 5%. This is than saved in the list item counter value
var profileCompleteness = 0, key;
for (key in Apperyio.storage.trader.get()) {
console.log("key = ", key);
if (Apperyio.storage.trader.get("$['" + key + "']") !== "") {
profileCompleteness += 5;
}
}
$("span.ui-li-count").text(profileCompleteness.toString() + "%");
Thank you for update! Glad it works now!