Code Monkey home page Code Monkey logo

jquery-data-table-plugin's Introduction

jQuery data table plugin

Simple jQuery plugin to allow you to convert HTML table to jQuery object.

Demo

Check it the demo out by following link.

Getting started

This plugin required font-awesome 4.1.0, bootstrap and jQuery, import it first.

<link href="http://mytest.no-ip.net/admin/plugins/bootstrap/bootstrap.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

Then, import dataTable.js and dataTable.css

<script src="dataTable.js"></script>
<link href="dataTable.css" rel="stylesheet">

The setup is done, let's begin to coding. It is very simple just attach dataTable to the table. In this example, $("#myTable") is attached with dataTable and with myData.

$(function(){
	$("#myFIFATable").dataTable({
		data: [
				["Country"	,"GP"	,"Win"	,"Draw"	,"Lose"],
				["Brazil"	,"3"	,"2"	,1	,"0"],
				["Mexico"	,"3"	,"2"	,1	,"0"],
				["Croatia"	,"3"	,"1"	,0	,"2"],
				["Cameroon"	,"3"	,"0"	,0	,"3"]
			]
	});
});	

Features

  • Able to coding with bootstrap
  • some simple tools such as edit, remove
  • onDataChanged event, this event fired when cell value is change
  • Easy to reset data

Sample code

<!DOCTYPE html>
<html lang="jp">
<head>
	<link href="http://mytest.no-ip.net/admin/plugins/bootstrap/bootstrap.css" rel="stylesheet">
	<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
	<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
	<script src="dataTable.js"></script>
	<link href="dataTable.css" rel="stylesheet">
	<script>

$(function(){
	$("#myFIFATable").dataTable({
		data: [
				["Country"	,"GP"	,"Win"	,"Draw"	,"Lose"],
				["Brazil"	,"3"	,"2"	,1	,"0"],
				["Mexico"	,"3"	,"2"	,1	,"0"],
				["Croatia"	,"3"	,"1"	,0	,"2"],
				["Cameroon"	,"3"	,"0"	,0	,"3"]
			]
	});
});	
</script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="span8">
				<table id="myFIFATable" class="table table-bordered table-striped table-heading"></table>
			</div>
		</div>
	</div>
</body>
</html>

jquery-data-table-plugin's People

Watchers

 avatar

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.