Skip to Content

Unable to pass values from my table row to dialog box sap ui5

Apr 30, 2017 at 09:46 AM


avatar image

Hi All,

In my table, I have created a toolbar which has a display button. When the display button is clicked, a dialog box opens and the data of the selected row is passed to it. But while doing so, I am getting an error - "Uncaught TypeError: oTable.attachRowSelect is not a function".

1. My table -

2. Dialog box -

3. Code -

Please let me know what I am doing wrong?



dialog-values.png (30.2 kB)
table.png (36.2 kB)
dialog-box.png (50.7 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Akhilesh Upadhyay May 01, 2017 at 09:06 AM

to get the context no need to attach row selected event, even you can get that using row index, check below code may help you

var ind = oTable.getSelectedIndex();

var selectedRow = this.oTable.getAggregation("rows")[ind]

var oContext = selectedRow.oBindingContexts;

//now you can get path from oContext and get property value from model i.e. oModel.getProperty(path + "/AProject");

// or you can get direct values from cells from selectedRow

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Hi Akhilesh,

Thanks for your reply. Sorry to ask this. But what should be passed in "rows" ? (var selectedRow = this.oTable.getAggregation("rows")[ind] )..

I am getting an error - Uncaught TypeError: Cannot read property 'getAggregation' of undefined

Former Member
Meenakshi Raina

you're passing the reference of the table as this.oTable.getAggregation("rows") whereas it has to be oTable.getAggregation("rows")


no need to pass anything, thats aggregation of the table, and yes i think small typo i did, remove this keyword, you got error due to table was not found in that particular line of code



I tried to use this. But in debugging , the object remains undefined -

debug.png (33.0 kB)

all well, till now your code is correct. you are getting an object in oContext along with one property i.e. undefined

that undefined is nothing but model name, if you have named model then it should be displayed here instead of undefined.

you can get path as : selectedRow.oBindingContexts.undefined.sPath

Sharath M G Apr 30, 2017 at 10:29 PM

why are you attaching the function of the table inside the toolbar? It should be outside toolbar .

Check it .



Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Sharath,

Thanks for your reply. This is because I wanted to select the data of the particular row of the table. and then pass it to the dialog box. So I am using attachrowSelect event for that.

Please guide me if I am doing wrong.




The event is when user selects the row of the table. You could check to attach it to table. In the toolbar you can always get the selected rows

Meenakshi Raina May 28, 2017 at 12:27 PM

Hi, just wanted to add the code that worked for me -

capture.png (23.6 kB)
10 |10000 characters needed characters left characters exceeded