Giter VIP home page Giter VIP logo

jsontable's Introduction

json Table

A simple jQuery plugin to get your JSON data on a table.

Gettings started

You can use a table already attached to the DOM, or one you created in memory. jsonTable needs at least a thead with a tr, and a tbody. If they don't exist, they will be created.

Initialize the table with the columns titles, and json identities to look for in the loaded file.

$("#dataTable").jsonTable({
	head : ['N.', 'Model','Operating System','Market Share'], // Goes on the <thead>
	json : ['*', 'model', 'name', 'share'] //json identities from the loaded json object
});				       // NOTE : an '*' identity will generate an autoincremented column

The JSON data in this case looks something like this.

[
    {"model" : "Iphone 18", "name" : "iOS", "share" : 57.56},
    {"model" : "Nexus 23", "name" : "Android", "share" : 24.66},
    {"model" : "Tom-tom", "name" : "Java ME", "share" : 10.72},
    {"model" : "Nokia 66610", "name" : "Symbian", "share" : 2.49},
    {"model" : "Blackberry", "name" : "Blackberry", "share" : 2.26},
    {"model" : "Lumia", "name" : "Windows Phone", "share" : 1.33}
]

Update the table from a JSON file. This could be the url to your JSON endpoint. Currently only GET requests are supported.

$("#dataTable").jsonTableUpdate("data.json");

####OR

Update data from a JSON object.

$("#dataTable").jsonTableUpdate([
    {"id" : 1, "name" : "iOS", "share" : 57.56},
    {"id" : 2, "name" : "Android", "share" : 24.66},
    {"id" : 3, "name" : "Java ME", "share" : 10.72},
    {"id" : 4, "name" : "Symbian", "share" : 2.49},
    {"id" : 4, "name" : "Blackberry", "share" : 2.26},
    {"id" : 4, "name" : "Windows Phone", "share" : 1.33}
]);

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.