Skip to Content
0
Jun 11, 2020 at 03:02 AM

get selected item from a table

2387 Views

Hi, experts

How can I get the selected item from a table in the controller? I have tried .getSelectedItem (), but it doesn't work

<Table id="tablegridv" selectionMode="SingleSelectMaster" enableSelectAll="false"
				rows="{path:'/CTRLACCESS',parameters:{expand:'ID_AREA,ID_ARL,ID_EPS,ID_SEDE',select:'ID_VISITA,FECHA,HORA,NOM_VISI,T_DOC,N_DOC,TELEFONO,SINTOMAS,OBSERVA,TEMP,ASIST,ID_SEDE_ID_SEDE,ID_AREA_ID_AREA,ID_EPS_ID_EPS,ID_ARL_ID_ARL,ID_AREA/ID_AREA,ID_AREA/NOM_AREA,ID_ARL/ID_ARL,ID_ARL/NOM_ARL,ID_EPS/ID_EPS,ID_EPS/NOM_EPS,ID_SEDE/ID_SEDE,ID_SEDE/NOM_SEDE,ID_SEDE/ID_CIUDAD_ID_CIUDAD'},sorter:[{path:'FECHA',descending:true},{path:'HORA',descending:true}]}"
				alternateRowColors="true" enableBusyIndicator="true" ariaLabelledBy="title">
				<noData>
					<m:BusyIndicator class="sapUiMediumMargin"/>
				</noData>
				<extension>
					<m:OverflowToolbar width="100%">
						<m:content>
							<m:Title id="title" text="Control de acceso a visitantes"/>
							<m:ToolbarSpacer/>
							<m:Button xmlns="sap.ui.table" xmlns:mvc="sap.ui.core.mvc" xmlns:u="sap.ui.unified" xmlns:c="sap.ui.core" xmlns:m="sap.m"
								icon="sap-icon://sys-add" tooltip="Añadir" press="onOpenDialog" id="button3"/>
							<m:Button icon="sap-icon://edit" tooltip="Editar"/>
							<m:Button xmlns="sap.ui.table" xmlns:mvc="sap.ui.core.mvc" xmlns:u="sap.ui.unified" xmlns:c="sap.ui.core" xmlns:m="sap.m"
								icon="sap-icon://delete" tooltip="Borrar" id="button2" press="onPressDelete"/>
							<m:Button icon="sap-icon://refresh" tooltip="Actualizar" press="onModelRefresh"/>
						</m:content>
					</m:OverflowToolbar>
				</extension>
				<columns>
					<Column sortProperty="FECHA" filterProperty="FECHA" autoResizable="true" width="6rem">
						<m:Label text="Fecha"/>
						<template>
							<m:Text text="{FECHA}" wrapping="false"/>
						</template>
					</Column>
					<Column sortProperty="HORA" filterProperty="HORA" autoResizable="true" width="5rem">
						<m:Label text="Hora"/>
						<template>
							<m:Text text="{HORA}" wrapping="false"/>
						</template>
					</Column>
					<Column sortProperty="NOM_VISI" filterProperty="NOM_VISI" autoResizable="true" width="6rem">
						<m:Label text="Nombre"/>
						<template>
							<m:Text text="{NOM_VISI}" wrapping="false"/>
						</template>
					</Column>
					<Column sortProperty="N_DOC" filterProperty="N_DOC" autoResizable="true" width="11rem">
						<m:Label text="Documento"/>
						<template>
							<m:Text text="{N_DOC}" wrapping="false"/>
						</template>
					</Column>
					<Column sortProperty="ID_EPS/NOM_EPS" filterProperty="ID_EPS/NOM_EPS" autoResizable="true" width="12rem">
						<m:Label text="EPS"/>
						<template>
							<m:Text text="{ID_EPS/NOM_EPS}" wrapping="false"/>
						</template>
					</Column>
					<Column filterProperty="ID_ARL/NOM_ARL" sortProperty="ID_ARL/NOM_ARL" width="9rem">
						<m:Label text="ARL"/>
						<template>
							<m:Text text="{ID_ARL/NOM_ARL}" wrapping="false"/>
						</template>
					</Column>
					<Column hAlign="End" autoResizable="true" width="9rem">
						<m:Label text="Telefono"/>
						<template>
							<m:Text text="{TELEFONO}" wrapping="false"/>
						</template>
					</Column>
					<Column hAlign="End" autoResizable="true" width="9rem">
						<m:Label text="Sede"/>
						<template>
							<m:Text text="{ID_SEDE/NOM_SEDE}" wrapping="false"/>
						</template>
					</Column>
					<Column hAlign="End" autoResizable="true" width="9rem">
						<m:Label text="Area a visitar"/>
						<template>
							<m:Text text="{ID_AREA/NOM_AREA}" wrapping="false"/>
						</template>
					</Column>
					<Column hAlign="End" autoResizable="true" width="9rem">
						<m:Label text="Temperatura"/>
						<template>
							<m:Text text="{TEMP}" wrapping="false"/>
						</template>
					</Column>
					<Column hAlign="End" autoResizable="true" width="9rem">
						<m:Label text="Observación"/>
						<template>
							<m:Text text="{OBSERVA}" wrapping="false"/>
						</template>
					</Column>
				</columns>
			</Table>

		

Greetings from Colombia