Skip to Content
Former Member
Oct 03, 2016 at 01:35 AM

SAPUI5 - Get selected data from table


Hi Experts,

I am new in SAPUI5. I have a question and hope you could help. A sample code would be highly appreciated.

I created a table with selection indicator. And I'd like to know how to get selected data from this table by press button.

I used Batch Update button to trigger the event BatchUpdate to get selected data in this table.However I don't know how.

Here is my code for view.

<mvc:View controllerName="EMP_BATCH.controller.View1" xmlns:html="" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
  id="Employees" inset="false" 
  path: '/EmpDetailsSet'  
  <Title text="Employee Info" level="H2"/>
  <Column width="1em">
  <Text text="Emp Id"/>
  <Column width="1em">
  <Text text="Name"/>
  <Column width="1em">
  <Text text="Address"/>
  <Column width="1em">
  <Text text="Salary"/>
  <Column width="1em">
  <Text text="Street1"/>
  <Column width="1em">
  <Text text="Street2"/>
  <Column width="1em">
  <Text text="City"/>
  <Column width="1em">
  <Text text="Country"/>
  <Text text="{EmpId}"/>
  <Input id="Name" value="{Name}"/>
  <!--<Text text="{Name}"/>-->
  <Text text="{Address}"/>
  <Text text="{Salary}"/>
  <Text text="{Details/Street1}"/>
  <Text text="{Details/Street2}"/>
  <Text text="{Details/City}"/>
  <Text text="{Details/Country}"/>

    <Button text="Batch Create" press="BatchCreate" />
    <Button text="Batch Update" press="BatchUpdate" />
    <Button text="Batch Delete" press="BatchDelete" />
    <Button text="Refresh" press="Refresh" />

Here is the code of my controller.

], function(Controller,MessageToast,Filter) {
  "use strict";

  return Controller.extend("EMP_BATCH.controller.View1", {
  onInit : function () {
  // Get OData Model and set it to view
  var oModel = this.getOwnerComponent().getModel();
  var oView = this.getView();

  BatchUpdate: function(evt){
// Get selected data from table ??????




Hope any expert could help.

Thanks in advance. 😊