ForgeComponents
en

Components

j-ImportCSV

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

Output of this component is mapped array. The component uses j-Directory component.


Configuration:

  • IMPORTANT datasource {String} a path to CSV data (String type)
  • skipfirst {Boolean} skips the first parsed line (default: true)
  • notdefined {String} a text for undefined columns (default: ---)
  • parent {String} jQuery selector for obtaining of width/height (default: parent)
  • dirsearch {String} a placeholder for search field (default: Search)
  • margin {Number} a margin for parent (default: 0)
  • marginxs {Number} optional, a top/bottom margin together for xs screen width
  • marginsm {Number} optional, a top/bottom margin together for sm screen width
  • marginmd {Number} optional, a top/bottom margin together for md screen width
  • marginlg {Number} optional, a top/bottom margin together for lg screen width

Use it with <ui-component name="importcsv">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

example.html
<ui-component name="directory"></ui-component>

<div style="width:500px;height:300px">
	<ui-component name="importcsv" path="output" config="datasource:data;keys:firstname=First name,lastname=Last name,email=Email;skipfirst:0"></ui-component>
	<ui-bind path="output" config="html b:value ? value.length : 0" class="block help">Total items for import: <b>0</b></ui-bind>
</div>

<script>

	var data = `Peter;Širka;peter@totalavengers.com\nTomáš,Novák,tomas@totalavengers.com\nDenis,Granec,denis@totalavengers.com`;
	var output = [];

</script>