Hi All,
I have created a simple app which has a view with a SearchField and Table. The search field also has liveChange feature and when the function is called, I call my query to backend system using oModel.read().
In the SearchField, the user can type either a material number or material description and as a result of liveChange, data is displayed in the table below the SearchField
When I delete the typed in text, the search results adjust accordingly, and when the searchfield is empty, no data is shown:
Problem: The problem begins when I start typing in the search field again, it appears that the table has lost its items cells structure.
The above view was created in XML.
I have created the same view in JS and it works fine.
Any suggestions? Please ask for more information and I will provide it as required.
Thanks.
Resolved using the following code:
onInit: function() { var oTab = this.getView().byId("idTblMat"); oTab.setModel(oJsonModelS); oTab.bindItems("/results", this.getView().byId("idColListItem") , null, null); },
liveChange
onSearch : function (oControlEvent) { var sPlant = this.getView().byId("idSelPlant"); var oTab = this.getView().byId("idTblMat"); var sQuery = oControlEvent.getParameter("newValue"); if (sQuery) { oModelS.read("/MaterialSet?$filter=Werks eq '" +sPlant.getSelectedKey()+ "' and Maktg eq '" +sQuery+ "' and Matnr eq '" +sQuery+ "' ", null,null,false,function(oData,repsonse){ oJsonModelS.setData(oData); oTab.bindItems("/results", sap.ui.getCore().byId("idColListItem") , null, null); }); } else { oJsonModelS.setData(); } },
Hi Aabhas,
If possible, can you share the code for table filter?
Regards,
Sai Vellanki.
Add a comment