sapui5 - Button needs two clicks for action -
i have sapui5 table show data sap odata service. in every row have textfield change amount of products. next field save button save changes using 2-way-binding. problem is, needs 2 clicks , triggers update method within sap correct triggers create method (and don't know why). have ideas?
onpresssave: function(evt) { var = this; var oapp = that.byid("myapp"); var omodel = that.getview().getmodel("mymodel"); var path = evt.getsource().getparent().getbindingcontextpath(); console.log(path); omodel.submitchanges( function(){ messagetoast.show(that._getmessage("it works!"), { duration:10000}); }, function(err) { messagetoast.show(that._getmessage("error"), { duration:10000}); } ); },
<table id="id" inset="false" items="{path: 'mymodel>/entryset'}"> <headertoolbar> </headertoolbar> <columns> <column><text text="{i18n>product}" /></column> <column width="60px" halign="right"><text text="{i18n>amount}" /></column> <column width="70px" halign="right"><text text="{i18n>pps}" /></column> <column width="33px" /> <column width="33px" /> </columns> <items> <columnlistitem> <cells> <objectidentifier title="{mymodel>materialname}" /> <input id="cartamount" value="{mymodel>amount}" /> <objectnumber class="sapuismallmarginbottom" number="{parts:[{path: 'mymodel>matprice'},{path: 'mymodel>matcurrency'}], type: 'sap.ui.model.type.currency', formatoptions: {showmeasure: true}}" /> <button icon="sap-icon://save" press="onpresssave" /> <button icon="sap-icon://delete" press="onpressdel" /> </cells> </columnlistitem> </items> </table>
thank in advance!
Comments
Post a Comment