Giter VIP home page Giter VIP logo

jquerycsvtotable's Introduction

jquerycsvtotable

Automatically exported from code.google.com/p/jquerycsvtotable The jQuery CSV to Table plugin reads in comma separated values (CSV) or tab separated values (TSV) data and generates an HTML table. Common spreadsheet programs, such as Microsoft Excel, are capable of saving in both CSV and TSV format.

By calling the CSVToTable() function on a DIV, and providing the path to a CSV or TSV file to download, the plugin loads in the data and creates an HTML table. For example, if a file called 'test.csv' contains the following data:

album,artist,price
"lateralus","tool",13.00
"aenima","tool",12.00
"10,000 days","tool",14.00
"down in it","nine inch nails",3.00
"broken","nine inch nails",6.00

A simple plugin call like:

  id="CSVTable">

<script>
$(function()  {
  $('#CSVTable').CSVToTable('test.csv');
});
</script>

Would produce:

album artist price
lateralus tool 13.00
aenima tool 12.00
10,000 days tool 14.00
down in it nine inch nails 3.00
broken nine inch nails 6.00

separator - separator to use when parsing CSV/TSV data value will almost always be "," or "\t" (comma or tab) if not specified, default value is "," headers - an array of headers for the CSV data if not specified, plugin assumes that the first line of the CSV file contains the header names. Example: headers: ['Album Title', 'Artist Name', 'Price ($USD)'] tableClass - class name to apply to the

tag rendered by the plugin. theadClass - class name to apply to the tag rendered by the plugin. thClass - class name to apply to the tag rendered by the plugin. trClass - class name to apply to the tag rendered by the plugin. tdClass - class name to apply to the
tag rendered by the plugin. tbodyClass - class name to apply to the
tag rendered by the plugin. loadingImage - path to an image to display while CSV/TSV data is loading loadingText - text to display while CSV/TSV is loading if not specified, default value is "Loading CSV data..."

The plugin will also trigger a "loadComplete" event upon successful render, so that you may use other jQuery plugins/code to modify the resulting table. One such example is the jQuery tablesorter plugin at http://tablesorter.com/

The example below shows how to fire code after the loadComplete event is triggered:

$('#CSVTable').CSVToTable('test.csv',     {        loadingImage:  'images/loading.gif',        startLine:  1,
       headers:  ['Album Title',  'Artist Name',  'Price ($USD)']    }
).bind("loadComplete",function()  {     $('#CSVTable').find('TABLE').tablesorter();
});;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.