2 weeks ago
Dear Expert,
I am refereing the SAP documentation to implement inline row creation in sap.ui.table.Table with OData V2 model, utilizing the create() method from the sap.ui.model.odata.v2.ODataListBinding library.
https://ui5.sap.com/#/topic/6c47b2b39db9404582994070ec3d57a2%23loio4c4cd99af9b14e08bb72470cc7cabff4
As per document i am getting the Rows context for the table and trying to use create() method. So, the entry is visible at the table without the need to first save it to the backend and then refresh the binding but the create() method is not defined.
********************Code Start ************************************
<!-- sap.ui.table.Table control declared in XML view -->
<Table id="ToLineItems" rows="{
events : {createActivate : '.onCreateActivateLineItem'}
path : 'ToLineItems'
}">
// controller coding
// initial creation of inline creation rows when data has been loaded
onInit : function () {
var oItemsBinding = this.getView().byId("ToLineItems").getBinding("rows");
oItemsBinding.attachEvent("dataReceived", function () {
// check that length is final before creating at end and only create inactive entry once
if (oItemsBinding.isLengthFinal() && oItemsBinding.isFirstCreateAtEnd() === undefined) {
that.onCreateActivateLineItem();
}
});
},
// event handler for createActivate
onCreateActivateLineItem : function (oEvent) {
// product id is a required property for the item => item remains inactive if it's not set
if (!oEvent.getParameter("context").getProperty("ProductID")) {
oEvent.preventDefault();
return;
}
var oItemsBinding = this.getView().byId("ToLineItems").getBinding("rows");
oItemsBinding.create({/* initial data*/}, /*bAtEnd*/ true, {inactive : true});
}
**************************Code End *************************
Could you please provide any advice or suggestions?
Regards,
Sandeep
Got the Solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got the Solution
create() in sap.ui.model.odata.v2.ODataListBinding is available since 1.98.0 version, i was using older UI version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.