Hi Weller,
Harbs is correct - you're not meant to be able to do that. The 'dataStore' is 'shared space' between multiple developers, and each developer can currently make sure that space stays private by choosing 'secret' keys - you don't want developer A to go poking into developer B's datastores.
So - it's a feature, not a shortcoming!
If you add multiple data store entries and you want to iterate _your_ private entries, one approach is to keep a 'table of contents' of all keys you create and store that into an additional entry - something like (pseudocode - I've not checked my syntax):
Code:function mySetDataStore(theItem,theKey,theValue)
{
// extract current table of contents for item. Could be a string or an array
var theTableOfContents = theItem.getDataStore("com.mycompany.myplugin.mytableofcontents");
// add if not in table yet - using a string in this example. Assumes keys don't contain "/" char
// 'Jams' keys between two "/".
if (theTableOfContents == undefined)
{
theTableOfContents = "/" + theKey + "/";
theItem.setDataStore("com.mycompany.myplugin.mytableofcontents",theTableOfContents);
}
else if (theTableOfContents.indexOf("/"+theKey+"/") < 0)
{
theTableOfContents += theKey + "/";
theItem.setDataStore("com.mycompany.myplugin.mytableofcontents",theTableOfContents);
}
theItem.setDataStore.setDataStore(theKey,theValue);
}
and you then religiously use mySetDataStore instead of .setDataStore, you'd end up with an interable table of contents of your keys (e.g. "/mykey1/mykey2/mykey123/") which is easy to split up and iterate.
Cheers,
Kris