Giter VIP home page Giter VIP logo

power-table's Introduction

基于jq生成table的插件

功能

  1. 自定义宽高
  2. 自定义隔行变色和标题颜色和hover颜色
  3. data可为数组或者url或者json文件路径
  4. 排序功能
  5. 分页功能

使用方法如下

  1. 首先引入Jq文件和该js文件路径
  2. 由于用到了fontawsome 中的图标,需要引入cdn, < link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
  3. body中插入div标签,可以不写类名或者ID,但是必须有一个div
  4. 上一步中的div中插入table标签,写上id
  5. script中引入相关API,如下:
$('#table').setTable({
	    //行宽和列高
	    lineWidth: 200,
	    lineHeight: 40,
	    //标题行
	    title: ['ID','name','age'],
	    //隔行变色,默认为白色,不需设置
	    color:{
            	    title:'red',
		    odd: 'blue',
		    even: 'yellow',
		    hover: 'pink'
	    },
	    //是否分页,默认不分页
	    page: {
		    status: true,
		    max: 3
	    },
	    //数据  在线url或者数组
	    data: [
		    {
			    id : 1,
			    name : 'jim',
			    age : 18
		    },
		    {
			    id : 2,
			    name : 'jim',
			    age : 18
		    },
		    {
			    id : 3,
			    name : 'ji2m',
			    age : 18
		    }]
    })

注:data属性也可直接写上url或者本地的json文件,直接写上字符串地址就行,比如data: 'data.json' 或者 data: '数据api地址'

power-table's People

Contributors

cyf0611 avatar

Stargazers

 avatar zhangzijian avatar Frederick Grae avatar

Watchers

James Cloos avatar Frederick Grae avatar

Forkers

hugohui

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.