Devuelve el ID de base de datos de un registro resaltado en el control de vista de lista.
Puede utilizar esta propiedad como respuesta a un suceso de pulsación de botón (es decir, el tipo de sucesos AD_BUTTON_CLICK) para averiguar el valor que se ha seleccionado en un recuadro de lista padre/hijo. Los métodos devuelven la clave principal del tipo de registro referenciado.
Con el objeto de obtener una selección de lista, debe asociar el botón al control de lista (como, por ejemplo, un control padre/hijo) del que desea que se pueda seleccionar un elemento. También debe seleccionar el tipo Vista de lista Otra. De este modo, al pulsar el botón, el valor devuelto es la clave del registro referenciado (las partes de claves multiparte están separadas por espacios).
VBScript
eventObject.ListSelection
VBScript
' The following script is invoked when a user presses a button named "Select"
' that is associated with a ListView control and performs an action of type
' "Other" (on the extended properties tab)):
Function Defect_Cust_Sel(param)
' param As Variant
Dim ListSel, Sel
On Error Resume Next
ListSel = param.ListSelection
Sel = ListSel(0)
SetFieldValue "Customer", Sel
End Function
' The following example checks for event type, session type, and whether or
' not something is selected:
Function MyRecordHook(param)
' param As Variant
' record type name isMyRecord
Dim ListSel
Dim Item
' Check if it is an event which you can have a selection for
if param.eventtype = AD_BUTTON_CLICK then
' Make sure you aren't on the web since ListSelection doesn't work
funciona
if not GetSession.HasValue("_CQ_WEB_SESSION") then
' OK we're not on the web. Now check to see if anything is
selected
ListSel = param.ListSelection
if ubound(ListSel) < lbound(ListSel) then
' Nothing is selected
else
Item = ListSel(0)
' ListSel is an array of strings with one element when
' something is selected
' and no elements when nothing is selected
' Put your code here to do what you need to do
msgbox "Selected item was:" & Item
end if
else
' Web interface, ListSelection API call doesn't work here
end if
else
' Its not a button click event, listselection only works with
' button click events
end if
End Function