Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8944

Re: How to import a csv file and read in sap ui5?

$
0
0

I tried to do this all from within the application but found it easier to just start with a JSON file. But, you can use a JS library to convert your CSV into JSON from within the application like this one:

archan937/csonv.js · GitHub

 

I just converted my CSV to JSON. Once you have that, all you need to do is instantiate a model for it and bind to table.

 

  onInit: function () {    var oModel = new sap.ui.model.json.JSONModel("PATH TO YOUR JSON FILE");    this.getView().setModel(oModel);  }
});
  <Table id="idProductsTable"    inset="false"    items="{      path: '/ProductCollection',      sorter: {        path: 'Name'      }    }">

The UI5 demo kit is a good resource. I believe it'll be same/similar for SAPUI5:

OpenUI5 SDK - Demo Kit

 

See here for example of defining your model and binding to a table:

sap.m Explored


Viewing all articles
Browse latest Browse all 8944

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>