json - How to delete row in SAPUI5 table with delete button embedded in the row -
json - How to delete row in SAPUI5 table with delete button embedded in the row -
i have xml sapui5 table delete button embedded in each rows. table bound json..
<table id="iduploadtable" mode="none" delete="handledeletelistitem" width="100%" items="{uiformmodel>/attachmentlist}"> <columns> <column id="idfilenamecol" valign="middle"> <header> <label text="file name" /> </header> </column> <column id="iduploadedobycol" halign="left" valign="middle"> <header> <label text="uploaded by" /> </header> </column> <column id="iduploadedoncol" halign="left" valign="middle"> <header> <label text="uploaded on" /> </header> </column> <column id="iduploadeddelcol" halign="left" valign="middle"> <header> <label text="" /> </header> </column> </columns> <items> <columnlistitem> <cells> <link text="{uiformmodel>filename}" href="{uiformmodel>filelocation}" target="blank"/> <text text="{uiformmodel>uploadedbyusername}" /> <text text="{uiformmodel>uploadedon}" /> <button icon="sap-icon://delete" press="handledeleteattachment"> <customdata> <core:customdata key="multi" value="true" /> </customdata> </button> </cells> </columnlistitem> </items> </table>
table bound json model able load info above json table. what want is, when user clicks on delete button embedded in row, specific row needs deleted. table selection mode has none
. how can accomplish above mentioned code baseline?
thanks in advance.. faddy
on handler button click, need "binding path". path in model root instance data. can it's value, go model, select corresponding instance , remove it. table updates automatically. binding path part along lines of :
new sap.ui.commons.button({ /* ... */ press: function(e){ var spath = e.getsource().getbindingcontext('uiformmodel').getpath(); var omodel = sap.ui.getcore().getmodel('uiformmodel'); var orowdata = omodel.getproperty(spath); } }
hope helps
json sapui5
Comments
Post a Comment