Transfer List filled programatically

I want to use the new component New-UDTransferList to list items both in left and right list from a list of values in SQL Server, but it seems you cannot fill the “selected list” beforehand.
Am I right?

You can use the -SelectedItem parameter for that.

      New-UDTransferList -Item {
        New-UDTransferListItem -Name 'test1' -Value 1
        New-UDTransferListItem -Name 'test2' -Value 2
        New-UDTransferListItem -Name 'test3' -Value 3
        New-UDTransferListItem -Name 'test4' -Value 4
        New-UDTransferListItem -Name 'test5' -Value 5
    }  -SelectedItem (1,3)

image

thats correct, but it seems that -OnChange parameter only retrieves first item in selectedlist

Ah, ok. I think OnChange is currently only providing which item was selected but I thnk it makes sense to provide all selected items.

Hi Adam,

The OnChange function doesn’t provide the selected item. The Function provides the first element from the list of selected Items.

If you have, for an example, on the left side 1,3,5 and on the right side (selected) 2 and 4 and you will transfer 3 to the selected side, the OnChange function has the item with the value 2 in the EventData variable (first element in the list)

And another “bug”. When the list starts with, for example 2 and 1 as the selected items. The $EventData.listName has an array of String (1,2) in the Form OnSubmit function. When i then push an new element from the left side to the right (selected) side I get an array of PSCustomObjects. [{name: ‘a’, value: 1}, … ]

Both of these issues have been resolved in our nightly 2.5 build.