cancel
Showing results for 
Search instead for 
Did you mean: 

Tables & Dropdowns

jansch
Participant
0 Kudos

Hello,

I would like to have dropdowns in a table to change the status of each row.

What I did so far: See code velow

XML:


<Table rows="{/opportunities}" >

     <Column>

           <m:Label text="Status" />

                    <template>

                            <m:Select change="changeStatus" selectedKey="{Status}" items="{/stati}" >

                                <c:Item text="{Status}" key="{Status}" />

                            </m:Select>

                    </template>

   </Column>

     <Column>

           <m:Label text="Transaction ID" />

            <template>

                      <m:Text text="{TransactionID}"/>

          </template>

   </Column>

</Table>

Javascript:


changeStatus: function(Selection){

        var sel = Selection.getParameter("selectedItem").getText();

        alert(sel);

}

So whenever I select a Status, I also want to get the "TransactionID" so that I know for which ID I want to change the status.

Hwo do I do that?

Greetings,

Jan

Accepted Solutions (1)

Accepted Solutions (1)

saivellanki
Active Contributor
0 Kudos

Hi Jan,

Will this help? JS Bin - Collaborative JavaScript Debugging


changeStatus: function(oEvent){

      var oSelectedItem = oEvent.getSource().getParent();

   var oBindingContext = oSelectedItem.getBindingContext();

   var oModel = oBindingContext.getObject();

   alert(JSON.stringify(oModel));

}

Regards,

Sai Vellanki.

jansch
Participant
0 Kudos

Thanks! Exactly what I was looking for, many thanks for that

One more thing you might be able to tell me: I am planning to add a kind of "You sure you want to save"-thing. If I don't want to save, the dropdown needs to be reset to default. How do I do that?

saivellanki
Active Contributor
0 Kudos

Hi,


You mean something like this? JS Bin - Collaborative JavaScript Debugging


Regards,

Sai Vellanki.

jansch
Participant
0 Kudos

You're amazing! Thank you so much. Works like charm

Answers (0)