Skip to Content
0
Former Member
Aug 17, 2015 at 12:54 PM

How to get the xpath corresponding to delete button in ColumnListItem?

68 Views

Hello experts,

I have a question,how to get the xpath corresponding to delete button in columnListItem?

what I want is when click delete button in item line,delete the item in table and delete the json item corresponding to table item.

I have done with add item function:handleAddItem,but I don't know how to delete.

View.xml

<Table id="createItems" headerText="" items="{new>/Items}" >

<columns>

<Column>

<header hAlign="Center" >

<Label text="{i18n>PreqItem}" />

</header>

</Column>

<Column hAlign="Center" >

<header>

<Label text="{i18n>Quantity}" />

</header>

</Column>

<Column hAlign="Center" >

<header>

<Label text="{i18n>DelivDate}" />

</header>

</Column>

<Column hAlign="Center" >

<header>

<Label text="{i18n>ShortText}" />

</header>

</Column>

<Column hAlign="Right" width="3em">

<header>

<Button icon="sap-icon://add" press="handleAddItem" />

</header>

</Column>

</columns>

<ColumnListItem type="Navigation" press="handleLineItemPress" >

<cells>

<Input type="Text" placeholder="{i18n>PreqItem}" value="{new>PreqItem}" />

<Input type="Text" placeholder="{i18n>Quantity}" value="{new>Quantity}" />

<Input type="Text" placeholder="{i18n>DelivDate}" value="{new>DelivDate}" />

<Input type="Text" placeholder="{i18n>ShortText}" value="{new>ShortText}" />

<Button icon="sap-icon://delete" press="handleDeleteItem" />

</cells>

</ColumnListItem>

</Table>

controller.js

handleAddItem : function(evt) { var view = this.getView(); var bindingContext = view.getBindingContext("new"); var path = bindingContext.getPath(); var object = bindingContext.getModel().getProperty(path); object.Items.push({Accounts : [], ServiceLines : [], TextLines : []}); bindingContext.getModel().setProperty(path, object); },

handleDeleteItem : function(evt) {

},

binding json:

{

"PreqNo" : "",

"PrType" : "NB",

"Testrun" : "",

"Commit" : "",

"Eerpid" : "",

"Code" : "",

"Message" : "",

"ApplicationNumber" : "SP00115081200014",

"ApplicationID" : "002573",

"SN" : "13791_17",

"Items" : [{

"PreqNo" : "",

"PreqItem" : "10",

"DocType" : "NB",

"PurGroup" : "A50",

"CreatedBy" : "",

"PreqName" : "liufang4",

"DelivDate": "2015-08-11T00:00:00",

"ShortText" : "Firoi行项目短文本",

"Plant" : "2293",

"Quantity" : "1.000",

"Unit" : "AU",

"ItemCat" : "9",

"Acctasscat" : "K",

"PurchOrg" : "1123",

"Currency" : "CNY",

"Accounts" : [{

"PreqNo" : "",

"PreqItem" : "00010",

"SerialNo" : "01",

"PreqQty" : "1.000",

"GLAcct" : "4301010099",

"CostCtr" : "1442060301"

}],

"ServiceLines" : [{

"PreqNo" : "",

"PreqItem" : "00010",

"SerialNo" : "01",

"ExtLine" : "0000000010",

"Quantity" : "1.000",

"BaseUom" : "AU",

"GrPrice" : "1.0000",

"ShortText" : "Firoi 服务行短文本 ShortText01"

}],

"TextLines" : [{

"PreqNo" : "10090599",

"PreqItem" : "00010",

"TextId" : "B01",

"TextLine" : "Firoi 行项目文本 Text Line01"

}, {

"PreqNo" : "10090599",

"PreqItem" : "00010",

"TextId" : "B02",

"TextLine" : "Firoi 行项目文本 Text Line02"

}]

}],

"TextLines" : [{

"PreqNo" : "",

"PreqItem" : "00000",

"TextId" : "B01",

"TextLine" : "Firoi 抬头文本"

}]

}

thank you

best regards,

felix.

Attachments