cancel
Showing results for 
Search instead for 
Did you mean: 

How To Use selectionChange With smarttable

former_member247972
Participant
0 Kudos

Currently trying to select a row from a smart table using selectionChange but the event is not firing in the contoller.

What is the correct way to use the smart table to select the row?

See below:

<core:View 
	xmlns:core="sap.ui.core" 
	xmlns="sap.m" 
	xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
	xmlns:smartTable="sap.ui.comp.smarttable"
	xmlns:html="http://www.w3.org/1999/xhtml"
	xmlns:smartForm="sap.ui.comp.smartform"
	xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
	controllerName="ECSB1.CommRateSFWA169.controller.Worklist"
	height="100%">
	<smartForm:SmartForm 
		id="smartForm"
		title="{i18n>worklistTitle}">
	</smartForm:SmartForm>
	<smartFilterBar:SmartFilterBar 
		id="smartFilterBar" 
		entitySet="CommRateView" 
		persistencyKey="SmartFilter_Explored">
		<smartFilterBar:controlConfiguration>
		</smartFilterBar:controlConfiguration>
	</smartFilterBar:SmartFilterBar>
	<smartTable:SmartTable 
		id="ID" 
		entitySet="CommRateView" 
		smartFilterId="smartFilterBar" 
		tableType="ResponsiveTable" 
		useExportToExcel="true"
		beforeExport="onBeforeExport" 
		useVariantManagement="true" 
		useTablePersonalisation="true" 
		header="Line Items" 
		showRowCount="true"
		persistencyKey="SmartTableAnalytical_Explored" 
		enableAutoBinding="true" 
		demandPopin="true" 
		class="sapUiResponsiveContentPadding">
		<Table 
			selectionChange="onSelectionChange"
    		mode="SingleSelectMaster">
		</Table>
	</smartTable:SmartTable>
</core:View>

sap.ui.define([
	"./BaseController",
	"sap/ui/model/json/JSONModel",
	"../model/formatter",
	"sap/ui/model/Filter",
	"sap/ui/model/FilterOperator"
], function (BaseController, JSONModel, formatter, Filter, FilterOperator) {
	"use strict";


	return BaseController.extend("ECSB1.CommRateSFWA169.controller.Worklist", {


		formatter: formatter,
		
		onInit: function () {},
		
		onSelectionChangeChange : function (oEvent) {
			// The source is the list item that got pressed
			this._showObject(oEvent.getSource());
		}


	});
});

Accepted Solutions (0)

Answers (1)

Answers (1)

Kishannaicker
Participant
0 Kudos

Hi Thomas,

Try using rowSelectionChange instead of selectionChange event.

Regards,

Kishan Naicker