Skip to Content
avatar image
Former Member

how to get data from odata services in search field of value help

search method in controller of value help is posted.No reference of xml(like id of some list) is to be taken since the  search field is in the controller part of value help.plz help. 

if (oFilterBar.setBasicSearch) {

  

  oFilterBar.setBasicSearch(new sap.m.SearchField({showSearchButton:true, placeholder:"Search", enabled:true,

  LiveChange:function(){

  if (this.getValue().length > 0){

  var oDataObj = new sap.ui.model.odata.ODataModel("http://services.odata.org/Northwind/Northwind.svc/");

  //var oDataObj = new sap.ui.model.json.JSONModel("http://services.odata.org/Northwind/Northwind.svc/Categories?$format=json");

  sap.ui.getCore().setModel(oDataObj,"OdataObj");

  this.bindElement({ path: "/CompanyCodeValuehelp", parameters: {expand: "CompanyCodeName",select: "CompanyCodeName"}});

  }

  }})); 

  }

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 23, 2015 at 11:32 AM

    Hi Monoka,

    JSON Model - The JSON model is a client-side model and, therefore, intended for small datasets, which are completely available on the client. The JSON model does not support mechanisms for server-based paging or loading of deltas. It supports, however, two-way binding.

    1. var oModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/Northwind/Northwind.svc");  
    2. sap.ui.getCore().setModel(oModel); 
    3. var oText = new sap.ui.commons.TextView("l1", {text: "{CompanyName}"});  
    4. oText.bindElement("/Customers('ALFKI')"); 
    5. oText.placeAt("content"); 

    refer:

    Thanks,

    Karthik A

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      i have to implement search field in value help..s

      hould i write this code in  the suggest function of search field or sumwhere else?

  • avatar image
    Former Member
    Oct 27, 2015 at 07:47 AM

    i have to implement search field in value help..s

    hould i write this code in  the suggest function of search field or sumwhere else?

    Add comment
    10|10000 characters needed characters exceeded