Skip to Content
0

How to read Value of a cell from sap.ui.table.Table?

Mar 15, 2017 at 06:49 AM

757

avatar image

Hi,

I want to get the value of a cell from a sap.ui.table, when I click on that cell. This cell is having 'Link' parameter; so, when I press on the link it's firing an event. In that evnt I should be able to get that value of that cell. Below is the code.

<Column width="auto" filterProperty="Owner" defaultFilterOperator="StartsWith">
	<m:Label text="{i18n>opOwner}"/>
	<template>
		<m:Link text="{tableModel>Owner}" press="handleLinkPress"/>
	</template>
</Column>
handleLinkPress : function(oEvent){
			
			var cell = "";

He in variable 'cell' I need to capture the Text of that cell.

I'm new in SAPUI5. Any help would be much appreciated. It would be very helpful if I can get the proper syntax.

Also, how to add date filter in date column.

<Column
	width="auto"
	filterProperty="Start_Date"
	defaultFilterOperator="StartsWith">
<m:Label text="{i18n>opstartdate}"/>
	<template>
		<m:Text text="{path: 'tableModel>Start_Date', type: 'sap.ui.model.type.Date', formatOptions: { pattern: 'dd/MM/yyyy' } }"/>
	</template>
</Column>
 

I've added the filter, but it's not working

Thanks,

Shubhrajit Chowdhury

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Seungchul Yang Mar 15, 2017 at 07:40 AM
1
handleLinkPress : function(oEvent){
			
			var cell = oEvent.getSource().getText();
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks Seungchui. It solved my problem.

What about the date filter in column header level? Any help on that would be very helpful.

0
saurabh vakil Mar 15, 2017 at 07:01 AM
1

There are a huge number of posts available that address this, please search the forums.

Refer:

How to read the data from selected SAPUI5 table row

Understanding sap.ui.table.Table in 10 minutes,

Share
10 |10000 characters needed characters left characters exceeded
Shubhrajit Chowdhury Mar 15, 2017 at 07:44 AM
0

Hi Saurabh,

Thanks for quick reply.

The documents you've shared, it's more about selecting a Row and get the data. But I don't want to use Selectrow functionality. I want to read the Text of a selected "Cell".

Here, if I click any of the value, I need to capture the Text. In this case it's 'admin5 sap'.

Thanks,

Shubhrajit


temp.png (3.6 kB)
Share
10 |10000 characters needed characters left characters exceeded
Dennis Seah
Mar 17, 2017 at 05:47 AM
0
handleLinkPress = function(oEvent) {
var oObject = oEvent.getSource().getBindingContext('tableModel').getObject(); // then you can do oObject.Owner }
Share
10 |10000 characters needed characters left characters exceeded