This content has been marked as final. Show 4 replies
Can you use event.currentTarget.selectedIndex to work directly with the item in the dataprovider?
I'm not sure I understand your suggestion. The selectedIndex doesn't give me the recordID that I need to shoot off another query into the database.
Simplistically, what I'd like to do is this:
- take the recordID that I'm displaying in the alert window
- hold recordID in a variable someplace (url?)
- switch states and load a different component
- retrieve the recordID so I can place another remoteObject call to the database using the recordID
Hopefully that makes a little more sense.
Thanks for any help.
If the "recordID" data is in your dataprovider, accessing this item through selectedIndex will allow you to manipulate it/use it at will directly in the dataprovider. Including getting at the "recordID" data and sending another query.
-User clicks on an item in the data grid.
-Call function which accesses that item's data directly in the dataprovider:
item = myDG.dataProvider.getItemAt(event.currentTarget.selectedIndex);
trace(item.recordID); (also allows accessing other data in the item) OR
Use your current code to get it: event.currentTarget.selectedItem.recordID.
-Call an HTTPService (or whatever rpc you are using) and pass that "recordID" as a parameter within it.
-In the rpc result handler (if data was returned), switch states and load new component with the data.
You can also get the id directly from target.selectedItem.recordID;
Just saves a step. rtalton's suggestion is how I would do it also.
If you have not used ViewStack, you should look at it as a replacement for States. it is often much simpler to work with.