Skip to main content

Posts

Showing posts from December, 2017

Import and render CSV to HTML table & map Columns dynamically

Hello there,


Today I am going to tell you how to Upload a.CSV file and Render it's data to HTML table and then how to map the header columns with your columns dynamically. Sometimes in the ERP systems, this type of things are really helpful. OK Let's begin.




I am using angularjs for frontend and PhaclonPhp for the backend.
Here's is the code for input file button (I am using nv-file-upload) :
After the file uploads complete we have to handle a function for rendering the content of the file to HTML table format. For that add a button in your HTML and define a function in angularjs controller and convert the file-content into a temporary array in PhalconPhp Framework :
First, handle the click function :


Then in the php code write this Action :

Note : For using vminstead of $scopeyou have to define var vm = this;in your controller.

Here, onCompleteItem is inbuilt function in nv-file-upload. Then create a table in html using angularjs :
The first row is for the drop-downs of the pre-ge…