Skip to Content

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

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?

Regards

Meenakshi

dialog-values.png (30.2 kB)
table.png (36.2 kB)
dialog-box.png (50.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • 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 .

    Regards,

    Sharath

    Add comment
    10|10000 characters needed characters exceeded

  • May 28, 2017 at 12:27 PM

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

    Add comment
    10|10000 characters needed characters exceeded