cancel
Showing results for 
Search instead for 
Did you mean: 

how to get a cell click event of a custom cell in a ui.table?

haemma83
Active Participant
0 Kudos

Hello,

i got following code:

	<t:Table id="SeqSubTable" selectionMode="MultiToggle"  rowSelectionChange="onSelChangeSeq" cellClick="selectText" rowActionCount="2"
				visibleRowCountMode="Auto" >
				
				<t:rowSettingsTemplate></t:rowSettingsTemplate>
				<t:rowActionTemplate>
					<t:RowAction></t:RowAction>
				</t:rowActionTemplate>
		
				<t:Column width="100px" sortProperty="Yield"	>
					<t:customData useSmartField="true">
						<core:CustomData key="p13nData"
							value='\{"columnKey": "Yield", "autoColumnWidth": \{ "visibleProperty": "Yield" }, "columnIndex": 3, "leadingProperty": "Yield", "sortProperty": "Yield", "description": "Gutmenge", "displayBehaviour": "descriptionOnly", "width": "360px"}' />
					</t:customData>
					<t:label>
						<Text text="Gutmenge"/>
					</t:label>
					<t:template>
						<Input id="yield" value="{ path: 'Yield', type: 'sap.ui.model.type.Float',  formatOptions: {minFractionDigits: 3}, columnIndex: 3}" editable="true" onfocusin="selectText" />
					</t:template>
				</t:Column>

How can i manage to get the Cellclick? I simply want to select the text in the clicked cell (Input)?

The normal CellClick Event works JUST for the predefined fields - but not for the custom ones.

Thanks

Andreas

Accepted Solutions (1)

Accepted Solutions (1)

haemma83
Active Participant
0 Kudos

Thanks - the focus event works now:

sap.ui.define([
	"sap/m/Input"
], function (Input) {
	"use strict";
	return Input.extend("CustomInput", {

		metadata: {
			events: {
				focus: {
					input : { type: "object" }
				}
			}
		},

		renderer: {},

		onAfterRendering: function () {
			if (sap.m.Input.onAfterRendering) {
				sap.m.Input.onAfterRendering.apply(this, arguments);
			}

			this.$().find('input').focus(function () {
				this.fireEvent('focus', { input: this });
			}.bind(this));
		}
	});
});

Answers (1)

Answers (1)

former_member221786
Active Participant
0 Kudos

Hi Andreas,

cellClick event works if you click outside of the input box but inside the cell.

For your requirement you need to implement a click event on the input box as there is no such event implemented in the standard version of the control.

So either you extend the input control and implement/fire the click event yourself or you use a control which has such an event already available.

Hope this helps!