on 2016 Apr 21 4:31 PM
Hello Experts
I want to fetch value of one field from the table on press of delete button but unable to do so.
below is my table and I want to get Member Name on click of Delete button as shown in last column
Below are values in debug mode and membername is coming as blank. This is a new TextField I created (outside the columnlistItem ) and assigned same binding {Membername} as you can see in columnListItem first column "Member Name". As there is no value getting populated so text field is also not visible on screen
onDelete: function(oEvent) {
var oItem = oEvent.getParameter("listItem");
var sPath = oItem.getBindingContext().getPath();
var membername = this.getView().byId("membername1").getText();
var oServiceModel = this.getView().getModel();
Also I observed that I am able to get field values of Main Entity set and not this Member details Entity Set as shown in table above in details page, this Member Details Entity gets values based Main Header Entity which is displayed in Master page.
Below is html code, Text I am trying to display and get value is in line 34 below
<IconTabFilter id="iconTabBarFilter1" tooltip="{i18n>detailIconTabBarInfo}" icon="sap-icon://course-book" textDirection="RTL" iconColor="Negative">
<content>
<Table xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic" busyIndicatorDelay="{detailView>/lineItemTableDelay}" class="sapUiResponsiveMargin" id="lineItemsList" items="{IssueDetailSet}" noDataText="{i18n>detailLineItemTableNoDataText}" updateFinished="" width="auto" mode="Delete" delete="onDelete">
<headerToolbar>
<Toolbar id="lineItemsToolbar">
<Title id="lineItemsHeader" text="{detailView>/lineItemListTitle}"/>
</Toolbar>
</headerToolbar>
<columns>
<Column id="__column4">
<Text text="{i18n>detailLineItemTableIDColumn}"/>
</Column>
<Column demandPopin="true" hAlign="Right" minScreenWidth="Tablet" id="__column5">
<Text text="Issue Date"/>
</Column>
<Column demandPopin="true" hAlign="Right" minScreenWidth="Tablet" id="__column6">
<Text text="Return Date"/>
</Column>
<Column demandPopin="true" hAlign="Right" minScreenWidth="Tablet" id="__column7">
<Text text=""/>
</Column>
</columns>
<items>
<ColumnListItem press="onNavToIssueDetail" type="Navigation" id="columnListItem">
<cells>
<ObjectIdentifier text="{ path: 'Membername' , formatter: '.formatter.titleCase'}" id="membername"/>
<ObjectNumber unit="{path: 'Issuedate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' }}" id="lineItemsList1"/>
<ObjectNumber xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic" unit="{ path: 'Returndate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' }} " state="{ path: 'Returndate', formatter:'.formatter.dateStatus'}" id="lineItemsList3"/>
<ObjectNumber xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic" unit="{ path: 'Returndate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium',relative: true, relativeScale: 'auto' }}" state="{ path: 'Returndate', formatter:'.formatter.dateStatus'}" id="lineItemsList2"/>
</cells>
</ColumnListItem>
</items>
</Table>
<Text text="{Membername}" maxLines="0" id="membername1"/>
<!--<sap.ui.core:InvisibleText xmlns:sap.ui.core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic" xmlns="sap.m"-->
<!-- text="{Membername}" id="membername1"/>-->
</content>
</IconTabFilter>
Request clarification before answering.
Hi,
Try
onDelete: function(oEvent) {
var oItem = oEvent.getParameter("listItem");
var oItemData = oItem.getBindingContext().getObject();
var membername = oItemData.Membername; // should resulting in membername = "Membername 1"
}
Greetz Silvio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're right about the sPath, but I never mentioned about this string.
What I did was fetching the whole data object bound to the oEvent.getParameter("listItem"); with my oItemData and within this particular data object - bound to this row - you can access all fields by their name (like "{Membername}" as the field I supposed you was wanting)
Hey Silvio
Thanks !! you solved my problem.
Being a ABAPer its very difficult to go on with JS
We dont even get code completions on methods in WED IDE from where we can get any hints, and even in console it has limitation.
Is there any way JS hurdle becomes a bit easier for ABAPes in Fiori ????
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.