all groups > macromedia flash flash remoting > march 2004 >
You're in the

macromedia flash flash remoting

group:

How do I get values from List.selectedItems


How do I get values from List.selectedItems bluestix
3/1/2004 10:06:05 AM
macromedia flash flash remoting:
I am trying to use data from the List.selectedItems to print only the selected
items from a datagrid.

My code so far looks like this:

on(press) {
selItems = MyDataGrid.selectedIndices;
trace("The selected indices are "+selItems);
trace("selItems.length is "+selItems.length);

var myArray = MyDataGrid.selectedItems;
trace("The selexted items are "+MyDataGrid.selectedItems)
trace("The selected Items are "+myArray)

}


My datagrid has a column called PKeyAccountID which contains the primary key
information for a recordset.
I want to use the data from the selected cells of this column to send back to
Coldfusion so that I can print only the selected records. (Flash doesnt seem to
be capable of doing this on its own thats why I am sending back to Coldfusion)

The help manual says:
Usage
listInstance.selectedItems

Description
Property (read-only); an array of the selected item objects. In a
multiple-selection list, selectedItems allows you to access the set of items
selected as item objects.

So how do I access the items selected as item objects?
I have tried using array syntax but that doesnt seem to work.

Any help would be greatly appreciated.

Kelly

[L=DigitalRorschach]http://www.digitalrorschach.com/AnomalousData.cfm[/L]
Re: How do I get values from List.selectedItems rllewellyn04
3/2/2004 2:58:18 AM
try setting up a Listener Object so you get an eventobject passed to you. then
you can get at it like this:

eventObject.target.selectedItem.PKeyAccountID

It works for me but my grid contains a recordset, don't understand it well
enough to know if it works in your case

good luck.
Re: How do I get values from List.selectedItems bluestix
3/2/2004 10:28:00 AM
I actually already knew how to get the value of the List.selectedItem but I
wanted to do the same for multiple Items.
I figured out a way to do it but it doesnt really make sense to me and doesnt
work exaclty as I would like.

It looks like this:

on(press) {
selItems = Contract.selectedIndices;
trace("The selected indices are "+selItems);
trace("selItems.length is "+selItems.length);


var IndexArray = "";
var IndexArray = new Array(selItems.length);


var myArray = Contract.selectedItems;



trace("The selexted items are "+Contract.selectedItems);
trace("The selected Items are "+myArray);

for (i=0; i<selItems.length; i++) {


for (PKeyAccountID in myArray[i]) {
trace ("myArray." + PKeyAccountID + " = " + myArray[i][PKeyAccountID]);
var pushed = IndexArray.unshift(myArray[i].PKeyAccountID)
trace("Items added to Index Array are "+pushed);
trace(IndexArray);

}



}
var IndexArray2 = IndexArray.toString()
trace("the String is "+IndexArray2)
}
on(release) {
getURL("PrintSort.cfm", "_blank", "POST");
}



This only kindof works. I am still trying to make sense of it.
AddThis Social Bookmark Button