Customize jquery table plug-in and jquery table

Source: Internet
Author: User

Customize jquery table plug-in and jquery table

It imitates the datagrid of easyui and only makes a rough picture. It will be optimized and added later.

Css style

/* CSS Document */body {    font: 14px/1.43 "Helvetica Neue", Tahoma, "Microsoft YaHei", Arial;    color: #253443;    margin: 0 auto;    padding: 0 auto;}table {    border-collapse: collapse;    border-spacing: 0;    background: #FFF;    font-size: 12px;    width: 100%;    border: 1;    width: 100%;}thead {    display: table-header-group;    vertical-align: middle;    border-color: inherit;}tr {    display: table-row;    vertical-align: inherit;    border-color: inherit;}table thead tr th {    padding: 5px 8px;    font-weight: normal;    color: #999;    border-bottom: 1px solid #B50802;    vertical-align: bottom;    line-height: 20px;}tbody {    display: table-row-group;    vertical-align: middle;    border-color: inherit;}table tbody tr td {    padding: 8px;    border-top: 0px;    border-bottom: 1px solid #DDD;    vertical-align: middle;    line-height: 20px;    text-align: center;}.mouseover {    background-color: #3A99AB;    color: #FFF;}

Custom jquery

// JavaScript Document $ (function () {var dataGrid = function (ele, opt) {this. defaults = {id: "", url: null, pageSize: 10, pageindex: 1} this. settings = $. extend ({}, this. defaults, opt);} dataGrid. prototype = {init: function () {this. create (); this. bindEvent () ;}, create: function () {var json = this. getAjaxDate (this. settings. url, null); var id = this. settings. id; $ ("#" + id ). append ("<thead> <tr> </thead> <tbody> </tbody>"); this. createTableHead (json. columns, id); this. createTableBody (json, id) ;}, // cyclically Add the header createTableHead: function (headcols, id) {for (var I = 0; I 

Json File

{"Columns": [{"field": "time", "title": "Release Date" },{ "field": "title", "title ": "title" },{ "field": "author", "title": "author"}], "data": [{"time ", "title": "dynamically generated grid", "author": "Administrator" },{ "time": "", "title": "dynamically generated grid ", "author": "Administrator" },{ "time": "2014-01-01", "title": "dynamically generated grid", "author": "Administrator "}, {"time": "2014-01-01", "title": "dynamic grid generation", "author": "Administrator"}]}

Html page call

<! Doctype html> 

Browser display

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.