Commit a4687cdc by aagusti

first

0 parents
Showing 358 changed files with 3320 additions and 0 deletions
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
0.0
---
- Initial version
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
include *.txt *.ini *.cfg *.rst
recursive-include esipkd *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml
i-sipkd
=======
esipkd README
For create Ziggurat tables run:
~/env/bin/initialize_esipkd_db development.ini
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###
[app:main]
use = egg:esipkd
reload_templates = true
debug_authorization = false
debug_notfound = false
debug_routematch = false
debug_templates = true
default_locale_name = en
sqlalchemy.url = postgresql://aagusti:a@127.0.0.1/esipkd
pyramid.includes =
pyramid_debugtoolbar
pyramid_tm
debugtoolbar.hosts = 127.0.0.1 192.168.56.1
session.type = ext:database
session.secret = s0s3cr3t
session.cookie_expires = true
session.key = WhatEver
session.url = postgresql://aagusti:a@127.0.0.1/esipkd
session.timeout = 3000
session.lock_dir = %(here)s/tmp
timezone = Asia/Jakarta
localization = id_ID.UTF-8
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543
# Begin logging configuration
[loggers]
keys = root, esipkd, sqlalchemy
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = INFO
handlers = console
[logger_esipkd]
level = DEBUG
handlers =
qualname = esipkd
[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither. (Recommended for production systems.)
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
# End logging configuration
No preview for this file type
COPY rekenings ( id, kode, uraian, level_id, is_summary)
FROM '/home/aagusti/env/esipkd/doc/rekening.csv'
DELIMITER ',' CSV HEADER QUOTE '"';
COPY units ( id, kode, uraian, level_id, is_summary)
FROM '/home/aagusti/env/esipkd/doc/unit.csv'
DELIMITER ',' CSV HEADER QUOTE '"';
\ No newline at end of file \ No newline at end of file
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
import locale
from pyramid.config import Configurator
from pyramid_beaker import session_factory_from_settings
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.security import has_permission
from pyramid.events import subscriber
from pyramid.events import BeforeRender
from pyramid.interfaces import IRoutesMapper
from pyramid.httpexceptions import (
default_exceptionresponse_view,
HTTPFound, HTTPNotFound
)
from sqlalchemy import engine_from_config
from .security import group_finder, get_user
from .models import (
DBSession,
Base,
init_model,
)
from .tools import DefaultTimeZone
# http://stackoverflow.com/questions/9845669/pyramid-inverse-to-add-notfound-viewappend-slash-true
class RemoveSlashNotFoundViewFactory(object):
def __init__(self, notfound_view=None):
if notfound_view is None:
notfound_view = default_exceptionresponse_view
self.notfound_view = notfound_view
def __call__(self, context, request):
if not isinstance(context, Exception):
# backwards compat for an append_notslash_view registered via
# config.set_notfound_view instead of as a proper exception view
context = getattr(request, 'exception', None) or context
path = request.path
registry = request.registry
mapper = registry.queryUtility(IRoutesMapper)
if mapper is not None and path.endswith('/'):
noslash_path = path.rstrip('/')
for route in mapper.get_routes():
if route.match(noslash_path) is not None:
qs = request.query_string
if qs:
noslash_path += '?' + qs
return HTTPFound(location=noslash_path)
return self.notfound_view(context, request)
# https://groups.google.com/forum/#!topic/pylons-discuss/QIj4G82j04c
def url_has_permission(request, permission):
return has_permission(permission, request.context, request)
@subscriber(BeforeRender)
def add_global(event):
event['permission'] = url_has_permission
def get_title(request):
route_name = request.matched_route.name
#return titles[route_name]
return None
routes = [
('home', '/', 'Home'),
('login', '/login', 'Login'),
('logout', '/logout', None),
('forbidden', '/forbidden', 'Forbidden'),
('password', '/password', 'Change password'),
('user', '/user', 'Users'),
('user-act', '/user/{act}/act', ''),
('user-add', '/user/add', 'Add user'),
('user-edit', '/user/{id}/edit', 'Edit user'),
('user-delete', '/user/{id}/delete', 'Hapus user'),
('group', '/group', 'Group'),
('group-act', '/group/{act}/act', ''),
('group-add', '/group/add', 'Tambah Group'),
('group-edit', '/group/{id}/edit', 'Edit Group'),
('group-delete', '/group/{id}/delete', 'Hapus Group'),
('pkb', '/pkb', 'Pajak Kendaraan Bermotor'),
('pkb-add', '/pkb/add', 'Pajak Kendaraan Bermotor'),
('pap', '/pap', 'Pajak Air Permukaan'),
('pap-add', '/pap/add', 'Pajak Air Permukaan'),
('pbbkb', '/pbbkb', 'PBB-KB'),
('pbbkb-act', '/pbbkb/{act}/act', ''),
('pbbkb-add', '/pbbkb/add', 'Tambah PBB-KB'),
('pbbkb-edit', '/pbbkb/{id}/edit', 'Edit PBB-KB'),
('pbbkb-delete', '/pbbkb/{id}/delete', 'Hapus PBB-KB'),
('hibah', '/hibah', 'Hibah'),
('hibah-act', '/hibah/{act}/act', ''),
('hibah-add', '/hibah/add', 'Tambah Hibah'),
('hibah-edit', '/hibah/{id}/edit', 'Edit Hibah'),
('hibah-delete', '/hibah/{id}/delete', 'Hapus Hibah'),
('lain', '/lain', 'Lain-lain'),
('lain-add', '/lain/add', 'Tambah Lain-lain'),
('lain-edit', '/lain/{id}/edit', 'Edit Lain-lain'),
('lain-act', '/lain/{act}/act', ''),
('lain-delete', '/lain/{id}/delete', 'Hapus Lain-lain'),
('coa', '/coa', 'COA'),
('coa-act', '/coa/{act}/act', ''),
('coa-add', '/coa/add', 'Tambah COA'),
('coa-edit', '/coa/{id}/edit', 'Edit COA'),
('coa-delete', '/coa/{id}/delete', 'Hapus COA'),
('skpd', '/skpd', 'SKPD/Unit'),
('skpd-act', '/skpd/{act}/act', ''),
('skpd-add', '/skpd/add', 'Tambah SKPD/Unit'),
('skpd-edit', '/skpd/{id}/edit', 'Edit SKPD/Unit'),
('skpd-delete', '/skpd/{id}/delete', 'Hapus SKPD/Unit'),
('jabatan', '/jabatan', 'Jabatan'),
('jabatan-act', '/jabatan/{act}/act', ''),
('jabatan-add', '/jabatan/add', 'Tambah Jabatan'),
('jabatan-edit', '/jabatan/{id}/edit', 'Edit Jabatan'),
('jabatan-delete', '/jabatan/{id}/delete', 'Hapus Jabatan'),
('pegawai', '/pegawai', 'Pegawai'),
('pegawai-act', '/pegawai/{act}/act', ''),
('pegawai-add', '/pegawai/add', 'Tambah Pegawai'),
('pegawai-edit', '/pegawai/{id}/edit', 'Edit Pegawai'),
('pegawai-delete', '/pegawai/{id}/delete', 'Hapus Pegawai'),
('pajak', '/pajak', 'Pajak'),
('pajak-act', '/pajak/{act}/act', ''),
('pajak-add', '/pajak/add', 'Tambah Pajak'),
('pajak-edit', '/pajak/{id}/edit', 'Edit Pajak'),
('pajak-delete', '/pajak/{id}/delete', 'Hapus Pajak'),
('wilayah', '/wilayah', 'Wilayah'),
('wilayah-act', '/wilayah/{act}/act', ''),
('wilayah-add', '/wilayah/add', 'Tambah Wilayah'),
('wilayah-edit', '/wilayah/{id}/edit', 'Edit Wilayah'),
('wilayah-delete', '/wilayah/{id}/delete', 'Hapus Wilayah'),
('wp', '/wp', 'Wajib Pajak'),
('wp-act', '/wp/{act}/act', ''),
('wp-add', '/wp/add', 'Tambah Wajib Pajak'),
('wp-edit', '/wp/{id}/edit', 'Edit Wajib Pajak'),
('wp-delete', '/pegawai/{id}/delete', 'Hapus Wajib Pajak'),
('op', '/op', 'Objek Pajak'),
('op-act', '/op/{act}/act', ''),
('op-add', '/op/add', 'Tambah Objek Pajak'),
('op-edit', '/op/{id}/edit', 'Edit Objek Pajak'),
('op-delete', '/op/{id}/delete', 'Hapus Objek Pajak'),
]
main_title = 'esipkd'
titles = {}
for name, path, title in routes:
if title:
titles[name] = ' - '.join([main_title, title])
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.bind = engine
init_model()
session_factory = session_factory_from_settings(settings)
if 'localization' not in settings:
settings['localization'] = 'id_ID.UTF-8'
locale.setlocale(locale.LC_ALL, settings['localization'])
if 'timezone' not in settings:
settings['timezone'] = DefaultTimeZone
config = Configurator(settings=settings,
root_factory='esipkd.models.RootFactory',
session_factory=session_factory)
config.include('pyramid_beaker')
config.include('pyramid_chameleon')
authn_policy = AuthTktAuthenticationPolicy('sosecret',
callback=group_finder, hashalg='sha512')
authz_policy = ACLAuthorizationPolicy()
config.set_authentication_policy(authn_policy)
config.set_authorization_policy(authz_policy)
config.add_request_method(get_user, 'user', reify=True)
config.add_request_method(get_title, 'title', reify=True)
#config.add_notfound_view(RemoveSlashNotFoundViewFactory())
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_static_view('deform_static', 'deform:static')
for name, path, title in routes:
config.add_route(name, path)
config.scan()
return config.make_wsgi_app()
from datetime import datetime
from sqlalchemy import (
Column,
Integer,
Text,
DateTime,
String
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
)
from zope.sqlalchemy import ZopeTransactionExtension
import transaction
import ziggurat_foundations.models
from ziggurat_foundations.models import BaseModel, UserMixin, GroupMixin
from ziggurat_foundations.models import GroupPermissionMixin, UserGroupMixin
from ziggurat_foundations.models import GroupResourcePermissionMixin, ResourceMixin
from ziggurat_foundations.models import UserPermissionMixin, UserResourcePermissionMixin
from ziggurat_foundations.models import ExternalIdentityMixin
from ziggurat_foundations import ziggurat_model_init
from pyramid.security import (
Allow,
Authenticated,
Everyone,
ALL_PERMISSIONS
)
from pyramid.httpexceptions import (
HTTPFound, HTTPNotFound
)
from ..tools import as_timezone
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base()
##############
# Base model #
##############
class CommonModel(object):
def to_dict(self): # Elixir like
values = {}
for column in self.__table__.columns:
values[column.name] = getattr(self, column.name)
return values
def from_dict(self, values):
for column in self.__table__.columns:
if column.name in values:
setattr(self, column.name, values[column.name])
def as_timezone(self, fieldname):
date_ = getattr(self, fieldname)
return date_ and as_timezone(date_) or None
class DefaultModel(CommonModel):
id = Column(Integer, primary_key=True)
def save(self):
if self.id:
#Who knows another user edited, so use merge ()
DBSession.merge(self)
else:
DBSession.add(self)
@classmethod
def query(cls):
return DBSession.query(cls)
@classmethod
def query_id(cls, id):
return cls.query().filter_by(id=id)
@classmethod
def get_by_id(cls, id):
return cls.query_id(id).first()
@classmethod
def delete(cls, id):
cls.query_id(id).delete()
class KodeModel(DefaultModel):
kode = Column(String(64), unique=True)
@classmethod
def query_kode(cls, kode):
return cls.query().filter_by(kode=kode)
@classmethod
def get_by_kode(cls, kode):
return cls.query_kode(kode).first()
class NamaModel(KodeModel):
nama = Column(String(128))
@classmethod
def query_nama(cls, nama):
return cls.query().filter_by(nama=nama)
@classmethod
def get_by_nama(cls, nama):
return cls.query_nama(nama).first()
class Group(GroupMixin, Base, CommonModel):
pass
class GroupPermission(GroupPermissionMixin, Base):
pass
class UserGroup(UserGroupMixin, Base):
@classmethod
def get_by_email(cls, email):
user = User.get_by_email(email)
return cls.get_by_user(user)
@classmethod
def _get_by_user(cls, user):
return DBSession.query(cls).filter_by(user_id=user.id).all()
@classmethod
def get_by_user(cls, user):
groups = []
for g in cls._get_by_user(user):
groups.append(g.group_id)
return groups
@classmethod
def set_one(cls, session, user, group):
member = DBSession.query(cls).filter_by(user_id=user.id, group_id=group.id)
try:
member = member.one()
except NoResultFound:
member = cls(user_id=user.id, group_id=group.id)
DBSession.add(member)
transaction.commit()
@classmethod
def set_all(cls, user, group_ids=[]):
if type(user) in [StringType, UnicodeType]:
user = User.get_by_email(user)
olds = cls._get_by_user(user)
news = []
for group_id in group_ids:
group = DBSession.query(Group).get(group_id)
member = cls.set_one(user, group)
news.append(group)
for old in olds:
if old not in news:
old.delete()
DBSession.commit()
@classmethod
def get_by_group(cls, group):
users = []
for g in DBSession.query(cls).filter_by(group=group):
users.append(g.user)
return users
class GroupResourcePermission(GroupResourcePermissionMixin, Base):
pass
class Resource(ResourceMixin, Base):
pass
class UserPermission(UserPermissionMixin, Base):
pass
class UserResourcePermission(UserResourcePermissionMixin, Base):
pass
class User(UserMixin, BaseModel, CommonModel, Base):
last_login_date = Column(DateTime(timezone=True), nullable=True)
registered_date = Column(DateTime(timezone=True),
nullable=False,
default=datetime.utcnow)
def _get_password(self):
return self._password
def _set_password(self, password):
self._password = self.set_password(password)
password = property(_get_password, _set_password)
def get_groups(self):
return UserGroup.get_by_user(self)
def last_login_date_tz(self):
return as_timezone(self.last_login_date)
def registered_date_tz(self):
return as_timezone(self.registered_date)
def nice_username(self):
return self.user_name or self.email
@classmethod
def get_by_email(cls, email):
return DBSession.query(cls).filter_by(email=email).first()
@classmethod
def get_by_name(cls, name):
return DBSession.query(cls).filter_by(user_name=name).first()
@classmethod
def get_by_identity(cls, identity):
if identity.find('@') > -1:
return cls.get_by_email(identity)
return cls.get_by_name(identity)
class ExternalIdentity(ExternalIdentityMixin, Base):
pass
class RootFactory(object):
def __init__(self, request):
self.__name__ = ''
self.__acl__ = [
(Allow, Authenticated, 'delete'),
(Allow, Authenticated, 'view'),
(Allow, Authenticated, 'read'),
(Allow, Authenticated, 'edit'),
(Allow, Authenticated, 'add'),
(Allow, Authenticated, 'delete'),
(Allow, 'Admin', ALL_PERMISSIONS),
(Allow, 'Staff', 'view'),
(Allow, Everyone, 'view'),
]
"""
class UserResourceFactory(object):
def __init__(self, request):
self.__acl__ = []
rid = request.matchdict.get("resource_id") or 1
if not rid:
raise HTTPNotFound()
self.resource = Resource.by_resource_id(rid)
if not self.resource:
raise HTTPNotFound()
if self.resource and request.user:
# append basic resource acl that gives all permissions to owner
self.__acl__ = self.resource.__acl__
# append permissions that current user may have for this context resource
for perm_user, perm_name in self.resource.perms_for_user(request.user):
self.__acl__.append((Allow, perm_user, perm_name,))"""
class GroupResourceFactory(object):
def __init__(self, request):
self.__acl__ = [(Allow,'Admin',ALL_PERMISSIONS),
(Allow, Everyone, 'view'),]
rid = request.matchdict.get("resource_id") or 1
if not rid:
raise HTTPNotFound()
self.resource = Resource.by_resource_id(rid)
if not self.resource:
raise HTTPNotFound()
if self.resource and request.user:
#groups = group_finder(request.user)
# append basic resource acl that gives all permissions to owner
self.__acl__ = self.resource.__acl__
# append permissions that current user may have for this context resource
for perm_group, perm_name in self.resource.perms_for_group(request.user):
self.__acl__.append((Allow, 'g:%s' % perm_group, perm_name,))
def init_model():
ziggurat_model_init(User, Group, UserGroup, GroupPermission, UserPermission,
UserResourcePermission, GroupResourcePermission, Resource,
ExternalIdentity, passwordmanager=None)
from sqlalchemy import (
Column,
Index,
Integer,
SmallInteger,
Text,
BigInteger,
String,
Float,
DateTime,
Date,
ForeignKey,
UniqueConstraint
)
from sqlalchemy.orm import relationship
from ..models import(
DefaultModel,
KodeModel,
NamaModel,
Base,
)
#####################
#
###########################
class Pkb(DefaultModel,Base):
__tablename__ = 'pkbs'
id = Column(BigInteger, primary_key=True)
nik = Column(String(16))
no_rangka = Column(String(16))
email = Column(String(32))
mobile_phone = Column(String(16))
class Pap(DefaultModel,Base):
__tablename__ = 'paps'
id = Column(BigInteger, primary_key=True)
no_skpd = Column(String(16))
email = Column(String(32))
mobile_phone = Column(String(16))
class Unit(NamaModel,Base):
__tablename__ = 'units'
id = Column(Integer, primary_key=True)
kode = Column(String(16), unique=True)
nama = Column(String(128))
level_id = Column(SmallInteger)
is_summary = Column(SmallInteger)
parent_id = Column(SmallInteger)
class Rekening(NamaModel,Base):
__tablename__ = 'rekenings'
id = Column(Integer, primary_key=True)
kode = Column(String(24), unique=True)
nama = Column(String(128))
level_id = Column(SmallInteger)
is_summary = Column(SmallInteger)
parent_id = Column(SmallInteger)
class UnitRekening(Base):
__tablename__ = 'unit_rekenings'
id = Column(Integer, primary_key=True)
unit_id = Column(Integer,ForeignKey("units.id"))
rekening_id = Column(Integer, ForeignKey("rekenings.id"))
class Jabatan(NamaModel, Base):
__tablename__ = 'jabatans'
status = Column(Integer, default=1)
#nama = Column(String(128))
class Pegawai(NamaModel, Base):
__tablename__ = 'pegawais'
#nama = Column(String(128))
status = Column(Integer, default=1)
jabatan_id = Column(Integer,ForeignKey("jabatans.id"))
unit_id = Column(Integer,ForeignKey("units.id"))
class PegawaiLogin(Base):
__tablename__ = 'pegawai_users'
user_id = Column(Integer,ForeignKey("users.id"), primary_key=True)
pegawai_id = Column(Integer,ForeignKey("pegawais.id"), unique=True)
change_unit = Column(Integer,default=0, nullable=False)
class Pajak(NamaModel, Base):
__tablename__ = 'pajaks'
status = Column(Integer, default=1)
rekening_id = Column(Integer,ForeignKey("rekenings.id"))
tahun = Column(Integer, nullable=False, default=0)
tarif = Column(Float, default=0, nullable=False)
UniqueConstraint('rekening_id','tahun', name='rekening_tahun')
class Wilayah(NamaModel,Base):
__tablename__ = 'wilayahs'
id = Column(Integer, primary_key=True)
kode = Column(String(24), unique=True)
nama = Column(String(128))
level_id = Column(SmallInteger)
parent_id = Column(Integer, ForeignKey('wilayahs.id'), nullable=True)
parent = relationship("Wilayah",
backref="child",
remote_side=[id])
class SubjekPajak(NamaModel, Base):
__tablename__ = 'subjekpajaks'
#nama = Column(String(128))
status = Column(Integer, default=1)
alamat_1 = Column(String(128))
alamat_2 = Column(String(128))
class ObjekPajak(NamaModel, Base):
__tablename__ = 'objekpajaks'
status = Column(Integer, default=1)
alamat_1 = Column(String(128))
alamat_2 = Column(String(128))
wilayah_id = Column(Integer, ForeignKey("wilayahs.id"))
unit_id = Column(Integer,ForeignKey("units.id"))
pajak_id = Column(Integer, ForeignKey("pajaks.id"))
subjekpajak_id = Column(Integer, ForeignKey("subjekpajaks.id"))
class Sptpd(Base):
__tablename__ = 'sptpds'
id = Column(Integer, primary_key=True)
unit_id = Column(Integer)
subjek_pajak_id = Column(Integer, ForeignKey("subjekpajaks.id"))
objek_pajak_id = Column(Integer, ForeignKey("objekpajaks.id"))
tahun = Column(Integer)
bulan = Column(Integer)
nama = Column(String(64))
alamat1 = Column(String(128))
alamat2 = Column(String(128))
omset = Column(BigInteger)
tarif = Column(Float)
pokok_pajak = Column(BigInteger)
denda = Column(BigInteger)
jatuh_tempo = Column(Date)
owner_id = Column(Integer)
create_uid = Column(Integer)
update_uid = Column(Integer)
create_date = Column(DateTime(timezone=True))
update_date = Column(DateTime(timezone=True))
status_bayar = Column(SmallInteger)
class Sts(Base):
__tablename__ = 'sts'
id = Column(Integer, primary_key=True)
no_bayar = Column(String(16))
unit_id = Column(Integer)
rekening_id = Column(Integer)
pokok_pajak = Column(BigInteger)
denda = Column(BigInteger)
create_uid = Column(Integer)
update_uid = Column(Integer)
create_date = Column(DateTime(timezone=True))
update_date = Column(DateTime(timezone=True))
status_bayar = Column(SmallInteger)
class StsItem(Base):
__tablename__ = 'sts_item'
sts_id = Column(Integer, primary_key=True)
sptpd_id = Column(Integer, primary_key=True)
class SSPD(Base):
__tablename__ = 'sspd'
sts_id = Column(Integer, primary_key=True)
sptpd_id = Column(Integer, primary_key=True)
denda = Column(BigInteger)
bayar = Column(BigInteger)
tgl_bayar = Column(DateTime)
tgl_entri = Column(DateTime)
create_uid = Column(Integer)
update_uid = Column(Integer)
create_date = Column(DateTime(timezone=True))
update_date = Column(DateTime(timezone=True))
class Param(Base):
__tablename__ = 'params'
id = Column(Integer, primary_key=True)
denda = Column(Integer)
jatuh_tempo = Column(Integer)
\ No newline at end of file \ No newline at end of file
import re
import transaction
from ..models import DBSession
SQL_TABLE = """
SELECT c.oid, n.nspname, c.relname
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relname = :table_name
AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 2, 3
"""
SQL_TABLE_SCHEMA = """
SELECT c.oid, n.nspname, c.relname
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relname = :table_name
AND n.nspname = :schema
ORDER BY 2, 3
"""
SQL_FIELDS = """
SELECT a.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod),
(SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)
FROM pg_catalog.pg_attrdef d
WHERE d.adrelid = a.attrelid
AND d.adnum = a.attnum
AND a.atthasdef),
a.attnotnull, a.attnum,
(SELECT c.collname
FROM pg_catalog.pg_collation c, pg_catalog.pg_type t
WHERE c.oid = a.attcollation
AND t.oid = a.atttypid
AND a.attcollation <> t.typcollation) AS attcollation,
NULL AS indexdef,
NULL AS attfdwoptions
FROM pg_catalog.pg_attribute a
WHERE a.attrelid = :table_id AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum"""
def get_table_seq(table_name):
t = table_name.split('.')
if t[1:]:
schema = t[0]
table_name = t[1]
sql = text(SQL_TABLE_SCHEMA)
q = engine.execute(sql, schema=schema, table_name=table_name)
else:
sql = text(SQL_TABLE)
q = engine.execute(sql, table_name=table_name)
r = q.fetchone()
table_id = r.oid
sql = text(SQL_FIELDS)
q = engine.execute(sql, table_id=table_id)
regex = re.compile("nextval\('(.*)'\:")
for r in q.fetchall():
if not r.substring:
continue
if r.substring.find('nextval') == -1:
continue
match = regex.search(r.substring)
return match.group(1)
def set_sequence(orm, seq_name):
row = DBSession.query(orm).order_by('id DESC').first()
last_id = row.id
seq_name = get_table_seq(orm.__tablename__)
sql = "SELECT setval('%s', %d)" % (seq_name, last_id)
engine = DBSession.bind
engine.execute(sql)
def set_sequences(ORMs):
for orm in ORMs:
set_sequence(orm)
def get_pkeys(table):
r = []
for c in table.constraints:
if c.__class__ is not PrimaryKeyConstraint:
continue
for col in c:
r.append(col.name)
return r
def insert_(engine, fixtures):
session_factory = sessionmaker(bind=engine)
session = session_factory()
metadata = MetaData(engine)
sequences = []
for tablename, data in fixtures:
table = Table(tablename, metadata, autoload=True)
class T(Base, BaseModel):
__table__ = table
keys = get_pkeys(table)
for d in data:
filter_ = {}
for key in keys:
val = d[key]
filter_[key] = val
q = session.query(T).filter_by(**filter_)
if q.first():
continue
u = T()
u.from_dict(d)
m = session.add(u)
seq_name = get_table_seq(tablename)
if seq_name:
sequences.append((T, seq_name))
session.commit()
set_sequences(sequences)
import re
import sys
from sqlalchemy import (
Table,
MetaData,
)
from sqlalchemy.orm import sessionmaker
from sqlalchemy.schema import PrimaryKeyConstraint
from sqlalchemy.sql.expression import text
import transaction
from ..models import (
Base,
BaseModel,
CommonModel,
DBSession,
User,
)
fixtures = [
('users', [
dict(
id=0,
email='anonymous@local',
user_name='anonymous',
status=0,
),
dict(
id=1,
email='admin@local',
user_name='admin',
password='admin',
status=1,
),
]),
]
SQL_TABLE = """
SELECT c.oid, n.nspname, c.relname
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relname = :table_name
AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 2, 3
"""
SQL_TABLE_SCHEMA = """
SELECT c.oid, n.nspname, c.relname
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relname = :table_name
AND n.nspname = :schema
ORDER BY 2, 3
"""
SQL_FIELDS = """
SELECT a.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod),
(SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)
FROM pg_catalog.pg_attrdef d
WHERE d.adrelid = a.attrelid
AND d.adnum = a.attnum
AND a.atthasdef),
a.attnotnull, a.attnum,
(SELECT c.collname
FROM pg_catalog.pg_collation c, pg_catalog.pg_type t
WHERE c.oid = a.attcollation
AND t.oid = a.atttypid
AND a.attcollation <> t.typcollation) AS attcollation,
NULL AS indexdef,
NULL AS attfdwoptions
FROM pg_catalog.pg_attribute a
WHERE a.attrelid = :table_id AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum"""
def table_seq(table_name):
engine = DBSession.bind
t = table_name.split('.')
if t[1:]:
schema = t[0]
table_name = t[1]
sql = text(SQL_TABLE_SCHEMA)
q = engine.execute(sql, schema=schema, table_name=table_name)
else:
sql = text(SQL_TABLE)
q = engine.execute(sql, table_name=table_name)
r = q.fetchone()
table_id = r.oid
sql = text(SQL_FIELDS)
q = engine.execute(sql, table_id=table_id)
regex = re.compile("nextval\('(.*)'\:")
for r in q.fetchall():
print table_name, r
#sys.exit()
if not r.substring:
continue
if r.substring.find('nextval') == -1:
continue
match = regex.search(r.substring)
return match.group(1)
def set_sequence(orm):
row = DBSession.query(orm).order_by('id DESC').first()
last_id = row.id
seq_name = table_seq(orm.__table__.name)
sql = "SELECT setval('%s', %d)" % (seq_name, last_id)
engine = DBSession.bind
engine.execute(sql)
def insert():
engine = DBSession.bind
tablenames = insert_(engine, fixtures)
metadata = MetaData(engine)
for item in fixtures:
tablename = item[0]
if tablename not in tablenames:
continue
class T(Base):
__table__ = Table(tablename, metadata, autoload=True)
set_sequence(T)
transaction.commit()
def get_pkeys(table):
r = []
for c in table.constraints:
if c.__class__ is not PrimaryKeyConstraint:
continue
for col in c:
r.append(col.name)
return r
def insert_(engine, fixtures):
session_factory = sessionmaker(bind=engine)
session = session_factory()
metadata = MetaData(engine)
tablenames = []
for tablename, data in fixtures:
if tablename == 'users':
T = User
table = T.__table__
else:
table = Table(tablename, metadata, autoload=True)
class T(Base, BaseModel, CommonModel):
__table__ = table
q = session.query(T).limit(1)
if q.first():
continue
tablenames.append(tablename)
keys = get_pkeys(table)
for d in data:
filter_ = {}
for key in keys:
val = d[key]
filter_[key] = val
q = session.query(T).filter_by(**filter_)
if q.first():
continue
tbl = T()
tbl.from_dict(d)
if tablename == 'users' and 'password' in d:
tbl.password = d['password']
m = session.add(tbl)
session.commit()
return tablenames
import os
import sys
import transaction
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from ..models import (
init_model,
DBSession,
Base,
)
from ..models.isipkd import *
import initial_data
ALEMBIC_CONF = """
[alembic]
script_location = ziggurat_foundations:migrations
sqlalchemy.url = {{db_url}}
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
"""
def usage(argv):
cmd = os.path.basename(argv[0])
print('usage: %s <config_uri>\n'
'(example: "%s development.ini")' % (cmd, cmd))
sys.exit(1)
def main(argv=sys.argv):
if len(argv) != 2:
usage(argv)
config_uri = argv[1]
setup_logging(config_uri)
settings = get_appsettings(config_uri)
# Create Ziggurat tables
alembic_ini_file = 'alembic.ini'
if not os.path.exists(alembic_ini_file):
alembic_ini = ALEMBIC_CONF.replace('{{db_url}}',
settings['sqlalchemy.url'])
f = open(alembic_ini_file, 'w')
f.write(alembic_ini)
f.close()
bin_path = os.path.split(sys.executable)[0]
alembic_bin = os.path.join(bin_path, 'alembic')
command = '%s upgrade head' % alembic_bin
os.system(command)
os.remove(alembic_ini_file)
# Insert data
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
init_model()
Base.metadata.create_all(engine)
initial_data.insert()
from pyramid.security import authenticated_userid
from .models import (
User,
UserGroup,
Group,
DBSession,
)
def group_finder(login, request):
u = User.get_by_identity(login)
if not u or not u.status:
return # None means logout
if u.id == 1:
return ['Admin']
r = []
for group_id in UserGroup.get_by_user(u):
group = DBSession.query(Group).get(group_id)
r.append(group.group_name)
return r
def get_user(request):
username = authenticated_userid(request)
if not username:
return
return User.get_by_identity(username)
This diff could not be displayed because it is too large.
body {
min-height: 2000px;
padding-top: 70px;
}
body {
padding-top: 70px;
--font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
--font-size: 10px;
--line-height: 1.42857143;
--color: #333333;
--background-color: #ffffff;
}
.navbar-brand {
padding: 5px;
margin-left: -15px;
}
.form-550 {
max-width: 550px;
padding: 15px;
margin: 0 auto;
}
label{
font-size: 12px;
}
.form-group {
margin-bottom: 5px;
}
.form-control {
background-color: #fff;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
color: #555;
display: block;
font-size: 12px;
height: 24px;
line-height: 1.42857;
padding: 3px 6px;
transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
vertical-align: middle;
width: 100%;
}
.paginate_button,
.btn{
font-size: 12px;
}
.dropdown-submenu{position:relative;}
.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;}
.dropdown-submenu:hover>.dropdown-menu{display:block;}
.dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#cccccc;margin-top:5px;margin-right:-10px;}
.dropdown-submenu:hover>a:after{border-left-color:#ffffff;}
.dropdown-submenu.pull-left{float:none;}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;}
/* dataTables Customize */
table.dataTable {
font-size: 12px;
}
table.dataTable thead {
background-color: #EAEAEA;
}
table.dataTable thead > tr > th{
padding: 4px;
}
table.dataTable tbody > tr > td{
--line-height: 1px;
padding: 4px;
}
table.dataTable tr.even.selected td {
background-color: #B0BED9;
}
table.dataTable tr.odd.selected td {
background-color: #9FAFD1;
}
table.dataTable tr.even td {
background-color: #FFFFFF;
}
table.dataTable tr.odd td {
background-color: #E2E4FF;
}
table.dataTable tr td {
vertical-align: middle;
}
table.dataTable tbody > tr > td.dataTables_empty {
line-height:inherit;
}
table.dataTable tbody td {
padding: 2px 2px;
}
table.dataTable th.right,
table.dataTable td.right {
text-align: right;
}
table.dataTable th.center,
table.dataTable td.center {
text-align: center;
}
div.tab-content {
padding-top: 10px;
}
.form-horizontal .form-group {
margin-bottom: 4px !important;
}
/* ga dipake - sayang dibuang */
.navbar {
border: 1px solid #DDDDDD;
}
.x.navbar.navbar-inverse.navbar-fixed-top {
background: #bc2131; /* Old browsers */
background: -moz-linear-gradient(top, #bc2131 0%, #f5f5f5 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#bc2131), color-stop(100%,#f5f5f5)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #bc2131 0%,#f5f5f5 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #bc2131 0%,#f5f5f5 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #bc2131 0%,#f5f5f5 100%); /* IE10+ */
background: linear-gradient(to bottom, #bc2131 0%,#f5f5f5 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bc2131', endColorstr='#f5f5f5',GradientType=0 ); /* IE6-9 */
border-width: 0px 0px 1px;
}
\ No newline at end of file \ No newline at end of file
body {
padding-top: 70px;
padding-bottom: 40px;
background-color: #eee;
}
.form-signin {
max-width: 450px;
padding: 15px;
margin: 0 auto;
background-color: #ffffff;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
margin-bottom: 10px;
}
.form-signin .checkbox {
font-weight: normal;
}
.form-signin .form-control {
position: relative;
font-size: 12px;
height: auto;
padding: 5px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin .control-label {
font-size: 12px;
}
.form-signin input[type="text"] {
margin-bottom: -1px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
\ No newline at end of file \ No newline at end of file
.content-image {
display: block;
}
.img-float {
float: left;
width: 150px;
height: 150px;
margin: 0 20px 10px 0;
padding: 10px;
border: 1px solid white;
display: inline-block;
-webkit-box-shadow: inset 0 0 20px #ADADAD;
box-shadow: inset 0 0 20px #ADADAD;
}
.navbar-inverse {
--background-color: #bc2131;
--background-color: #00AA00;
background-color: #009963;
border-color: #911926;
}
.navbar-inverse .navbar-brand {
color: #ffffff;
}
.navbar-inverse .navbar-brand:hover,
.navbar-inverse .navbar-brand:focus {
color: #ffffff;
background-color: #005500;
}
.navbar-inverse .navbar-text {
color: #333333;
}
.navbar-inverse .navbar-nav > li > a {
color: #ffffff;
}
.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > li > a:focus {
color: #ffffff;
background-color: #005500;
}
.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover,
.navbar-inverse .navbar-nav > .active > a:focus {
color: #ffffff;
background-color: #005500;
}
.navbar-inverse .navbar-nav > .disabled > a,
.navbar-inverse .navbar-nav > .disabled > a:hover,
.navbar-inverse .navbar-nav > .disabled > a:focus {
color: #444444;
background-color: transparent;
}
.navbar-inverse .navbar-toggle {
border-color: #333333;
}
.navbar-inverse .navbar-toggle:hover,
.navbar-inverse .navbar-toggle:focus {
background-color: #333333;
}
.navbar-inverse .navbar-toggle .icon-bar {
background-color: #ffffff;
}
.navbar-inverse .navbar-collapse,
.navbar-inverse .navbar-form {
border-color: #9e1c29;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .open > a:hover,
.navbar-inverse .navbar-nav > .open > a:focus {
background-color: #222222;
color: #ffffff;
}
.navbar-inverse .navbar-nav > .dropdown > a:hover .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
}
.navbar-inverse .navbar-nav > .dropdown > a .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
}
.navbar-inverse .navbar-nav > .open > a .caret,
.navbar-inverse .navbar-nav > .open > a:hover .caret,
.navbar-inverse .navbar-nav > .open > a:focus .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
}
# Contributing
If you are thinking of contributing code to DataTables, first of all, thank you! All fixes, patches and enhancements to DataTables are very warmly welcomed. In order to keep thing manageable, there are a number of guidelines that should be followed in order to ensure that your modification is included in DataTables as quickly as possible:
1. Make contributions in the DataTables/DataTablesSrc repo. Changes to the built files in the built repo (DataTables/DataTables) will not be accepted since they would be overwritten by the next build!
2. Follow the style of the code in the existing files. DataTables doesn't have a coding standards document, but simple common sense of following the same style as in the existing files is ideal. For example use tabs not spaces (as you will see all source files use tabs).
3. Link to a test page showing the bug you are fixing or the feature you are adding. This allows to me to quickly identify what is being changed and why. Don't worry about being verbose in pull requests - its much better to know exactly what is changing and why!
# DataTables plug-in for jQuery
DataTables is a table enhancing plug-in for the [jQuery](//jquery.com) Javascript library, adding sorting, paging and filtering abilities to plain HTML tables with minimal effort. The stated goal of DataTables is:
> To enhance the accessibility of data in HTML tables.
To meet this goal, DataTables is developed with two distinct groups of users in mind:
* You the developers using DataTables. For developers DataTables provides a wide array of options for how data should be obtained, displayed and acted upon, along with an extensive API for accessing and manipulating the table.
* End users. For those using the interface DataTables presents, actions to get the most from the information contained in tables, such as sorting and filtering, along with paging and scrolling of the data in table, are easy to use, intuitive and fast.
## Installation
In most cases, to use DataTables all you need to do is include jQuery, the DataTables Javascript and DataTables CSS files in your HTML page:
```html
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.0-beta.1/css/jquery.dataTables.css">
<script type="text/javascript" language="javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10-beta.1/js/jquery.dataTables.js"></script>
```
## Usage
In its simplest case, DataTables can be initialised with a single line of Javascript:
```js
$('table').dataTable();
```
where the jQuery selector is used to obtain a reference to the table you want to enhance with DataTables. Optional configuration parameters can be passed in to DataTables to have it perform certain actions by using a configuration object as the parameter passed in to the DataTables constructor. For example:
```js
$('table').dataTable( {
paginate: false,
scrollY: 300
} );
```
will disable paging and enable scrolling.
A full list of the options available for DataTables are available in the [documentation](//datatables.net).
## Documentation
Full documentation of the DataTables options, API and pug-in interface are available on the [DataTables web-site](//datatables.net). The site also contains information on the wide variety of plug-ins that are available for DataTables, which can be used to enhance and customise your table even further.
## Support
Support for DataTables is available through the [DataTables forums](//datatables.net/forums) and [commercial support options](//datatables.net/support) are available.
## License
DataTables is release under the [MIT license](//datatables.net/license). You are free to use, modify and distribute this software, as long as the copyright header is left intact (specifically the comment block which starts with `/*!`.
{
"name": "datatables",
"version": "1.10.0",
"main": [
"media/js/jquery.dataTables.js",
"media/css/jquery.dataTables.css"
],
"dependencies": {
"jquery": ">=1.7.0"
}
}
{
"name": "datatables/datatables",
"version": "1.10.0",
"description": "DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table.",
"homepage": "http://www.datatables.net/",
"author": "SpryMedia",
"license": [
"MIT"
],
"prefer-stable": true,
"support": {
"forum": "https://datatables.net/forums",
"source": "https://github.com/DataTables/DataTablesSrc/"
}
}
{
"name": "DataTables",
"version": "1.10.0",
"description": "DataTables enhances HTML tables with the ability to sort, filter and page the data in the table very easily. It provides a comprehensive API and set of configuration options, allowing you to consume data from virtually any data source.",
"homepage": "http://datatables.net/",
"docs": "http://datatables.net/",
"demo": "http://datatables.net/examples",
"download": "http://datatables.net/download",
"author": {
"name": "Allan Jardine",
"url": "http://sprymedia.co.uk"
},
"licenses": [
{
"type": "MIT",
"url": "http://datatables.net/license_bsd"
}
],
"dependencies": {
"jquery": ">=1.7"
},
"keywords": [
"DataTables",
"DataTable",
"table",
"grid",
"filter",
"sort",
"page",
"internationalisable"
]
}
# AutoFill
AutoFill gives an Excel like option to a DataTable to click and drag over multiple cells, filling in information over the selected cells and incrementing numbers as needed. Key features include:
* Click and drag cell content insertion
* Automatic incrementing of numeric information
* Enable and disable on any column
* Detailed callback functions for customisation
* Support for both DataTables and browser window scrolling
# Installation
To use AutoFill, first download DataTables ( http://datatables.net/download ) and place the unzipped AutoFill package into a `extensions` directory in the DataTables package. This will allow the pages in the examples to operate correctly. To see the examples running, open the `examples` directory in your web-browser.
# Basic usage
AutoFill is initialised using the `$.fn.dataTable.AutoFill` constructor. For example:
```js
$(document).ready( function () {
var table = $('#example').dataTable();
new $.fn.dataTable.AutoFill( table );
} );
```
# Documentation / support
* Documentation: http://datatables.net/extensions/autofill/
* DataTables support forums: http://datatables.net/forums
# GitHub
If you fancy getting involved with the development of AutoFill and help make it better, please refer to its GitHub repo: https://github.com/DataTables/AutoFill
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* AutoFill styles
*/
div.AutoFill_filler {
display: none;
position: absolute;
height: 14px;
width: 14px;
background: url(../images/filler.png) no-repeat center center;
z-index: 1002;
}
div.AutoFill_border {
display: none;
position: absolute;
background-color: #0063dc;
z-index: 1001;
box-shadow: 0px 0px 5px #76b4ff;
-moz-box-shadow: 0px 0px 5px #76b4ff;
-webkit-box-shadow: 0px 0px 5px #76b4ff;
}
div.AutoFill_filler{display:none;position:absolute;height:14px;width:14px;background:url(../images/filler.png) no-repeat center center;z-index:1002}div.AutoFill_border{display:none;position:absolute;background-color:#0063dc;z-index:1001;box-shadow:0px 0px 5px #76b4ff;-moz-box-shadow:0px 0px 5px #76b4ff;-webkit-box-shadow:0px 0px 5px #76b4ff}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<title>AutoFill examples - AutoFill examples</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>AutoFill example <span>AutoFill examples</span></h1>
<div class="info">
<p>AutoFill gives an Excel like option to a DataTable to click and drag over multiple cells, filling in
information over the selected cells and incrementing numbers as needed.</p>
<p>Thanks to <a href="http://www.phoniax.no/">Phoniax AS</a> for their sponsorship of this plug-in for
DataTables.</p>
</div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<div class="toc">
<div class="toc-group">
<h3><a href="./index.html">Examples</a></h3>
<ul class="toc">
<li><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./columns.html">Column options</a></li>
<li><a href="./scrolling.html">Scrolling DataTable</a></li>
<li><a href="./fill-both.html">Horizontal and vertical fill</a></li>
<li><a href="./fill-horizontal.html">Horizontal fill</a></li>
<li><a href="./complete-callback.html">Complete callback</a></li>
<li><a href="./step-callback.html">Step callback</a></li>
</ul>
</div>
</div>
<div class="epilogue">
<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
information about its API properties and methods.<br>
Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
<a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
DataTables.</p>
<p class="copyright">DataTables designed and created by <a href=
"http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
</div>
</div>
</div>
</section>
</body>
</html>
\ No newline at end of file \ No newline at end of file
/*!
AutoFill 1.2.0
©2008-2014 SpryMedia Ltd - datatables.net/license
*/
(function(p,j,l){var o=function(c,k){var h=function(d,b){if(!(this instanceof h))throw"Warning: AutoFill must be initialised with the keyword 'new'";if(!c.fn.dataTableExt.fnVersionCheck("1.7.0"))throw"Warning: AutoFill requires DataTables 1.7 or greater";this.c={};this.s={filler:{height:0,width:0},border:{width:2},drag:{startX:-1,startY:-1,startTd:null,endTd:null,dragging:!1},screen:{interval:null,y:0,height:0,scrollTop:0},scroller:{top:0,bottom:0},columns:[]};this.dom={table:null,filler:null,borderTop:null,
borderRight:null,borderBottom:null,borderLeft:null,currentTarget:null};this.fnSettings=function(){return this.s};this._fnInit(d,b);return this};h.prototype={_fnInit:function(d,b){var a=this;this.s.dt=k.Api?(new k.Api(d)).settings()[0]:d.fnSettings();this.s.init=b||{};this.dom.table=this.s.dt.nTable;c.extend(!0,this.c,h.defaults,b);this._initColumns();var e=c("<div/>",{"class":"AutoFill_filler"}).appendTo("body");this.dom.filler=e[0];this.s.filler.height=e.height();this.s.filler.width=e.width();e[0].style.display=
"none";var g,f=j.body;""!==a.s.dt.oScroll.sY&&(a.s.dt.nTable.parentNode.style.position="relative",f=a.s.dt.nTable.parentNode);g=c("<div/>",{"class":"AutoFill_border"});this.dom.borderTop=g.clone().appendTo(f)[0];this.dom.borderRight=g.clone().appendTo(f)[0];this.dom.borderBottom=g.clone().appendTo(f)[0];this.dom.borderLeft=g.clone().appendTo(f)[0];e.on("mousedown.DTAF",function(b){this.onselectstart=function(){return false};a._fnFillerDragStart.call(a,b);return false});c("tbody",this.dom.table).on("mouseover.DTAF mouseout.DTAF",
">tr>td, >tr>th",function(b){a._fnFillerDisplay.call(a,b)});c(this.dom.table).on("destroy.dt.DTAF",function(){e.off("mousedown.DTAF").remove();c("tbody",this.dom.table).off("mouseover.DTAF mouseout.DTAF")})},_initColumns:function(){var d=this,b,a,e=this.s.dt,g=this.s.init;b=0;for(a=e.aoColumns.length;b<a;b++)this.s.columns[b]=c.extend(!0,{},h.defaults.column);e.oApi._fnApplyColumnDefs(e,g.aoColumnDefs||g.columnDefs,g.aoColumns||g.columns,function(a,b){d._fnColumnOptions(a,b)});b=0;for(a=e.aoColumns.length;b<
a;b++)if(e=this.s.columns[b],e.read||(e.read=this._fnReadCell),e.write||(e.read=this._fnWriteCell),!e.step)e.read=this._fnStep},_fnColumnOptions:function(d,b){var a=this.s.columns[d],c=function(c,d){b[d[0]]!==l&&(a[c]=b[d[0]]);b[d[1]]!==l&&(a[c]=b[d[1]])};c("enable",["bEnable","enable"]);c("read",["fnRead","read"]);c("write",["fnWrite","write"]);c("step",["fnStep","step"]);c("increment",["bIncrement","increment"])},_fnTargetCoords:function(d){var b=c(d).parents("tr")[0],a=this.s.dt.oInstance.fnGetPosition(d);
return{x:c("td",b).index(d),y:c("tr",b.parentNode).index(b),row:a[0],column:a[2]}},_fnUpdateBorder:function(d,b){var a=this.s.border.width,e=c(d).offset(),g=c(b).offset(),f=e.left-a,i=g.left+c(b).outerWidth(),m=e.top-a,h=g.top+c(b).outerHeight(),j=g.left+c(b).outerWidth()-e.left+2*a,k=g.top+c(b).outerHeight()-e.top+2*a;e.left>g.left&&(f=g.left-a,i=e.left+c(d).outerWidth(),j=e.left+c(d).outerWidth()-g.left+2*a);""!==this.s.dt.oScroll.sY&&(a=c(this.s.dt.nTable.parentNode).offset(),e=c(this.s.dt.nTable.parentNode).scrollTop(),
g=c(this.s.dt.nTable.parentNode).scrollLeft(),f-=a.left-g,i-=a.left-g,m-=a.top-e,h-=a.top-e);a=this.dom.borderTop.style;a.top=m+"px";a.left=f+"px";a.height=this.s.border.width+"px";a.width=j+"px";a=this.dom.borderBottom.style;a.top=h+"px";a.left=f+"px";a.height=this.s.border.width+"px";a.width=j+"px";a=this.dom.borderLeft.style;a.top=m+"px";a.left=f+"px";a.height=k+"px";a.width=this.s.border.width+"px";a=this.dom.borderRight.style;a.top=m+"px";a.left=i+"px";a.height=k+"px";a.width=this.s.border.width+
"px"},_fnFillerDragStart:function(d){var b=this,a=this.dom.currentTarget;this.s.drag.dragging=!0;b.dom.borderTop.style.display="block";b.dom.borderRight.style.display="block";b.dom.borderBottom.style.display="block";b.dom.borderLeft.style.display="block";var e=this._fnTargetCoords(a);this.s.drag.startX=e.x;this.s.drag.startY=e.y;this.s.drag.startTd=a;this.s.drag.endTd=a;this._fnUpdateBorder(a,a);c(j).bind("mousemove.AutoFill",function(a){b._fnFillerDragMove.call(b,a)});c(j).bind("mouseup.AutoFill",
function(a){b._fnFillerFinish.call(b,a)});this.s.screen.y=d.pageY;this.s.screen.height=c(p).height();this.s.screen.scrollTop=c(j).scrollTop();""!==this.s.dt.oScroll.sY&&(this.s.scroller.top=c(this.s.dt.nTable.parentNode).offset().top,this.s.scroller.bottom=this.s.scroller.top+c(this.s.dt.nTable.parentNode).height());this.s.screen.interval=setInterval(function(){var a=c(j).scrollTop();b.s.screen.y=b.s.screen.y+(a-b.s.screen.scrollTop);b.s.screen.height-b.s.screen.y+a<50?c("html, body").animate({scrollTop:a+
50},240,"linear"):b.s.screen.y-a<50&&c("html, body").animate({scrollTop:a-50},240,"linear");b.s.dt.oScroll.sY!==""&&(b.s.screen.y>b.s.scroller.bottom-50?c(b.s.dt.nTable.parentNode).animate({scrollTop:c(b.s.dt.nTable.parentNode).scrollTop()+50},240,"linear"):b.s.screen.y<b.s.scroller.top+50&&c(b.s.dt.nTable.parentNode).animate({scrollTop:c(b.s.dt.nTable.parentNode).scrollTop()-50},240,"linear"))},250)},_fnFillerDragMove:function(d){if(d.target&&"TD"==d.target.nodeName.toUpperCase()&&d.target!=this.s.drag.endTd){var b=
this._fnTargetCoords(d.target);"y"==this.c.mode&&b.x!=this.s.drag.startX&&(d.target=c("tbody>tr:eq("+b.y+")>td:eq("+this.s.drag.startX+")",this.dom.table)[0]);"x"==this.c.mode&&b.y!=this.s.drag.startY&&(d.target=c("tbody>tr:eq("+this.s.drag.startY+")>td:eq("+b.x+")",this.dom.table)[0]);"either"==this.c.mode&&(b.x!=this.s.drag.startX?d.target=c("tbody>tr:eq("+this.s.drag.startY+")>td:eq("+b.x+")",this.dom.table)[0]:b.y!=this.s.drag.startY&&(d.target=c("tbody>tr:eq("+b.y+")>td:eq("+this.s.drag.startX+
")",this.dom.table)[0]));"both"!==this.c.mode&&(b=this._fnTargetCoords(d.target));var a=this.s.drag;a.endTd=d.target;b.y>=this.s.drag.startY?this._fnUpdateBorder(a.startTd,a.endTd):this._fnUpdateBorder(a.endTd,a.startTd);this._fnFillerPosition(d.target)}this.s.screen.y=d.pageY;this.s.screen.scrollTop=c(j).scrollTop();""!==this.s.dt.oScroll.sY&&(this.s.scroller.scrollTop=c(this.s.dt.nTable.parentNode).scrollTop(),this.s.scroller.top=c(this.s.dt.nTable.parentNode).offset().top,this.s.scroller.bottom=
this.s.scroller.top+c(this.s.dt.nTable.parentNode).height())},_fnFillerFinish:function(){var d=this,b,a;c(j).unbind("mousemove.AutoFill mouseup.AutoFill");this.dom.borderTop.style.display="none";this.dom.borderRight.style.display="none";this.dom.borderBottom.style.display="none";this.dom.borderLeft.style.display="none";this.s.drag.dragging=!1;clearInterval(this.s.screen.interval);var e=[],g=this.dom.table,f=this._fnTargetCoords(this.s.drag.startTd),i=this._fnTargetCoords(this.s.drag.endTd),h=function(a){return d.s.dt.oApi._fnVisibleToColumnIndex(d.s.dt,
a)};if(f.y<=i.y)for(b=f.y;b<=i.y;b++)if(f.x<=i.x)for(a=f.x;a<=i.x;a++)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:a-f.x,y:b-f.y,colIdx:h(a)});else for(a=f.x;a>=i.x;a--)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:a-f.x,y:b-f.y,colIdx:h(a)});else for(b=f.y;b>=i.y;b--)if(f.x<=i.x)for(a=f.x;a<=i.x;a++)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:a-f.x,y:b-f.y,colIdx:h(a)});else for(a=f.x;a>=i.x;a--)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:f.x-a,y:f.y-
b,colIdx:h(a)});if(!(1>=e.length)){var g=[],l;b=0;for(a=e.length;b<a;b++){var f=e[b],i=this.s.columns[f.colIdx],h=i.read.call(i,f.node),n=i.step.call(i,f.node,h,l,b,f.x,f.y);i.write.call(i,f.node,n);l=n;g.push({cell:f,colIdx:f.colIdx,newValue:n,oldValue:h})}null!==this.c.complete&&this.c.complete.call(this,g);k.Api?(new k.Api(this.s.dt)).draw(!1):this.s.dt.oInstance.fnDraw()}},_fnFillerDisplay:function(d){var b=this.dom.filler;if(!this.s.drag.dragging){var a="td"==d.target.nodeName.toLowerCase()?
d.target:c(d.target).parents("td")[0],e=this._fnTargetCoords(a).column;if(this.s.columns[e].enable)if("mouseover"==d.type)this.dom.currentTarget=a,this._fnFillerPosition(a),b.style.display="block";else{if(!d.relatedTarget||!d.relatedTarget.className.match(/AutoFill/))b.style.display="none"}else b.style.display="none"}},_fnFillerPosition:function(d){var b=c(d).offset(),a=this.dom.filler;a.style.top=b.top-this.s.filler.height/2-1+c(d).outerHeight()+"px";a.style.left=b.left-this.s.filler.width/2-1+c(d).outerWidth()+
"px"}};k.AutoFill=h;k.AutoFill=h;h.version="1.2.0";h.defaults={mode:"y",complete:null,column:{enable:!0,increment:!0,read:function(d){return c(d).html()},write:function(d,b){var a=c(d).parents("table");if(k.Api)a.DataTable().cell(d).data(b);else{var a=a.dataTable(),e=a.fnGetPosition(d);a.fnUpdate(b,e[0],e[2],!1)}},step:function(c,b,a,e,g,f){c=/(\-?\d+)/;return(e=this.increment&&a?a.match(c):null)?a.replace(c,parseInt(e[1],10)+(0>g||0>f?-1:1)):a===l?b:a}}};return h};"function"===typeof define&&define.amd?
define("datatables-autofill",["jquery","datatables"],o):jQuery&&!jQuery.fn.dataTable.AutoFill&&o(jQuery,jQuery.fn.dataTable)})(window,document);
# ColReorder
ColReorder adds the ability for the end user to click and drag column headers to reorder a table as they see fit, to DataTables. Key features include:
* Very easy integration with DataTables
* Tight integration with all other DataTables plug-ins
* The ability to exclude the first (or more) column from being movable
* Predefine a column order
* Save staving integration with DataTables
# Installation
To use ColReorder, first download DataTables ( http://datatables.net/download ) and place the unzipped ColReorder package into a `extensions` directory in the DataTables package. This will allow the pages in the examples to operate correctly. To see the examples running, open the `examples` directory in your web-browser.
# Basic usage
ColReorder is initialised using the `R` option that it adds to DataTables' `dom` option. For example:
```js
$(document).ready( function () {
$('#example').dataTable( {
"dom": 'Rlfrtip'
} );
} );
```
# Documentation / support
* Documentation: http://datatables.net/extensions/colreorder/
* DataTables support forums: http://datatables.net/forums
# GitHub
If you fancy getting involved with the development of ColReorder and help make it better, please refer to its GitHub repo: https://github.com/DataTables/ColReorder
/*
* Namespace DTCR - "DataTables ColReorder" plug-in
*/
table.DTCR_clonedTable {
background-color: rgba(255, 255, 255, 0.7);
z-index: 202;
}
div.DTCR_pointer {
width: 1px;
background-color: #0259C4;
z-index: 201;
}
\ No newline at end of file \ No newline at end of file
table.DTCR_clonedTable{background-color:rgba(255,255,255,0.7);z-index:202}div.DTCR_pointer{width:1px;background-color:#0259C4;z-index:201}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<title>ColReorder examples - ColReorder examples</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>ColReorder example <span>ColReorder examples</span></h1>
<div class="info">
<p>ColReorder adds the ability for the end user to click and drag column headers to reorder a table as
they see fit, to DataTables. Key features include:</p>
<ul class="markdown">
<li>Very easy integration with DataTables</li>
<li>Tight integration with all other DataTables plug-ins</li>
<li>The ability to exclude the first (or more) column from being movable</li>
<li>Predefine a column order</li>
<li>Save staving integration with DataTables</li>
</ul>
</div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<div class="toc">
<div class="toc-group">
<h3><a href="./index.html">Examples</a></h3>
<ul class="toc">
<li><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./new_init.html">Initialisation using `new`</a></li>
<li><a href="./alt_insert.html">Alternative insert styling</a></li>
<li><a href="./realtime.html">Realtime updating</a></li>
<li><a href="./state_save.html">State saving</a></li>
<li><a href="./scrolling.html">Scrolling table</a></li>
<li><a href="./predefined.html">Predefined column ordering</a></li>
<li><a href="./reset.html">Reset ordering API</a></li>
<li><a href="./colvis.html">ColVis integration</a></li>
<li><a href="./fixedcolumns.html">FixedColumns integration</a></li>
<li><a href="./fixedheader.html">FixedHeader integration</a></li>
<li><a href="./jqueryui.html">jQuery UI styling</a></li>
<li><a href="./col_filter.html">Individual column filtering</a></li>
<li><a href="./server_side.html">Server-side processing</a></li>
</ul>
</div>
</div>
<div class="epilogue">
<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
information about its API properties and methods.<br>
Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
<a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
DataTables.</p>
<p class="copyright">DataTables designed and created by <a href=
"http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
</div>
</div>
</div>
</section>
</body>
</html>
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<title>ColReorder example - Server-side processing</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.colReorder.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
<style type="text/css" class="init">
</style>
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="../js/dataTables.colReorder.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<script type="text/javascript" language="javascript" class="init">
$(document).ready(function() {
$('#example').dataTable( {
dom: 'Rlfrtip',
processing: true,
serverSide: true,
ajax: "../../../examples/server_side/scripts/objects.php",
columns: [
{ data: "first_name" },
{ data: "last_name" },
{ data: "position" },
{ data: "office" },
{ data: "start_date" },
{ data: "salary" }
]
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>ColReorder example <span>Server-side processing</span></h1>
<div class="info">
<p>Server-side processing can be exceptionally useful in DataTables when dealing with massive data
sets, and ColReorder works with this as would be expected.</p>
<p>It is recommend that you use object based data with server-side processing and ColReorder, as this
provides easily understandable mapping between the the columns and the data relation on the server,
otherwise you need to work out array indexes on each call!</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>
<ul class="tabs">
<li class="active">Javascript</li>
<li>HTML</li>
<li>CSS</li>
<li>Ajax</li>
<li>Server-side script</li>
</ul>
<div class="tabs">
<div class="js">
<p>The Javascript shown below is used to initialise the table shown in this
example:</p><code class="multiline brush: js;">$(document).ready(function() {
$('#example').dataTable( {
dom: 'Rlfrtip',
processing: true,
serverSide: true,
ajax: &quot;../../../examples/server_side/scripts/objects.php&quot;,
columns: [
{ data: &quot;first_name&quot; },
{ data: &quot;last_name&quot; },
{ data: &quot;position&quot; },
{ data: &quot;office&quot; },
{ data: &quot;start_date&quot; },
{ data: &quot;salary&quot; }
]
} );
} );</code>
<p>In addition to the above code, the following Javascript library files are loaded for use in this
example:</p>
<ul>
<li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
<li><a href=
"../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
<li><a href="../js/dataTables.colReorder.js">../js/dataTables.colReorder.js</a></li>
</ul>
</div>
<div class="table">
<p>The HTML shown below is the raw HTML table element, before it has been enhanced by
DataTables:</p>
</div>
<div class="css">
<div>
<p>This example uses a little bit of additional CSS beyond what is loaded from the library
files (below), in order to correctly display the table. The additional CSS used is shown
below:</p><code class="multiline brush: js;"></code>
</div>
<p>The following CSS library files are loaded for use in this example to provide the styling of the
table:</p>
<ul>
<li><a href=
"../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
<li><a href="../css/dataTables.colReorder.css">../css/dataTables.colReorder.css</a></li>
</ul>
</div>
<div class="ajax">
<p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
will update automatically as any additional data is loaded.</p>
</div>
<div class="php">
<p>The script used to perform the server-side processing for this table is shown below. Please note
that this is just an example script using PHP. Server-side processing scripts can be written in any
language, using <a href="//datatables.net/manual/server-side">the protocol described in the
DataTables documentation</a>.</p>
</div>
</div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<h2>Other examples</h2>
<div class="toc">
<div class="toc-group">
<h3><a href="./index.html">Examples</a></h3>
<ul class="toc active">
<li><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./new_init.html">Initialisation using `new`</a></li>
<li><a href="./alt_insert.html">Alternative insert styling</a></li>
<li><a href="./realtime.html">Realtime updating</a></li>
<li><a href="./state_save.html">State saving</a></li>
<li><a href="./scrolling.html">Scrolling table</a></li>
<li><a href="./predefined.html">Predefined column ordering</a></li>
<li><a href="./reset.html">Reset ordering API</a></li>
<li><a href="./colvis.html">ColVis integration</a></li>
<li><a href="./fixedcolumns.html">FixedColumns integration</a></li>
<li><a href="./fixedheader.html">FixedHeader integration</a></li>
<li><a href="./jqueryui.html">jQuery UI styling</a></li>
<li><a href="./col_filter.html">Individual column filtering</a></li>
<li class="active"><a href="./server_side.html">Server-side processing</a></li>
</ul>
</div>
</div>
<div class="epilogue">
<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
information about its API properties and methods.<br>
Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
<a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
DataTables.</p>
<p class="copyright">DataTables designed and created by <a href=
"http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
</div>
</div>
</div>
</section>
</body>
</html>
\ No newline at end of file \ No newline at end of file
# ColVis
ColVis adds a button to the toolbars around DataTables which gives the end user of the table the ability to dynamically change the visibility of the columns in the table:
* Dynamically show and hide columns in a table
* Very easy integration with DataTables
* Ability to exclude columns from being either hidden or shown
* Save saving integration with DataTables
# Installation
To use ColVis, first download DataTables ( http://datatables.net/download ) and place the unzipped ColVis package into a `extensions` directory in the DataTables package. This will allow the pages in the examples to operate correctly. To see the examples running, open the `examples` directory in your web-browser.
# Basic usage
ColVis is initialised using the `C` option that it adds to DataTables' `dom` option. For example:
```js
$(document).ready( function () {
$('#example').dataTable( {
"dom": 'C<"clear">lfrtip'
} );
} );
```
# Documentation / support
* Documentation: http://datatables.net/extensions/colvis/
* DataTables support forums: http://datatables.net/forums
# GitHub
If you fancy getting involved with the development of ColVis and help make it better, please refer to its GitHub repo: https://github.com/DataTables/ColVis
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* ColVis styles
*/
div.ColVis {
float: right;
margin-bottom: 1em;
}
button.ColVis_Button,
ul.ColVis_collection li {
position: relative;
float: left;
margin-right: 3px;
padding: 5px 8px;
border: 1px solid #999;
cursor: pointer;
*cursor: hand;
font-size: 0.88em;
color: black !important;
white-space: nowrap;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
-ms-border-radius: 2px;
-o-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 1px 1px 3px #ccc;
-moz-box-shadow: 1px 1px 3px #ccc;
-ms-box-shadow: 1px 1px 3px #ccc;
-o-box-shadow: 1px 1px 3px #ccc;
box-shadow: 1px 1px 3px #ccc;
/* Generated by http://www.colorzilla.com/gradient-editor/ */
background: #ffffff; /* Old browsers */
background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Chrome10+,Safari5.1+ */
background: -moz-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* FF3.6+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* IE10+ */
background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Opera 11.10+ */
background: linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */
}
.ColVis_Button:hover,
ul.ColVis_collection li:hover {
border: 1px solid #666;
text-decoration: none !important;
-webkit-box-shadow: 1px 1px 3px #999;
-moz-box-shadow: 1px 1px 3px #999;
-ms-box-shadow: 1px 1px 3px #999;
-o-box-shadow: 1px 1px 3px #999;
box-shadow: 1px 1px 3px #999;
background: #f3f3f3; /* Old browsers */
background: -webkit-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Chrome10+,Safari5.1+ */
background: -moz-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* FF3.6+ */
background: -ms-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* IE10+ */
background: -o-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Opera 11.10+ */
background: linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f3f3f3', endColorstr='#f4f4f4',GradientType=0 ); /* IE6-9 */
}
button.ColVis_Button {
height: 30px;
padding: 3px 8px;
}
button.ColVis_Button::-moz-focus-inner {
border: none !important;
padding: 0;
}
button.ColVis_Button:active {
outline: none;
}
div.ColVis_collectionBackground {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: black;
z-index: 1100;
}
ul.ColVis_collection {
width: 150px;
padding: 8px 8px 4px 8px;
margin: 0;
border: 1px solid #ccc;
border: 1px solid rgba( 0, 0, 0, 0.4 );
background-color: #f3f3f3;
background-color: rgba( 255, 255, 255, 0.3 );
overflow: hidden;
z-index: 2002;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
-ms-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
-o-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
}
ul.ColVis_collection li {
position: relative;
height: auto;
left: 0;
right: 0;
padding: 0.5em;
display: block;
float: none;
margin-bottom: 4px;
-webkit-box-shadow: 1px 1px 3px #999;
-moz-box-shadow: 1px 1px 3px #999;
-ms-box-shadow: 1px 1px 3px #999;
-o-box-shadow: 1px 1px 3px #999;
box-shadow: 1px 1px 3px #999;
}
ul.ColVis_collection li {
text-align: left;
}
ul.ColVis_collection li.ColVis_Button:hover {
border: 1px solid #999;
background-color: #f0f0f0;
}
ul.ColVis_collection li span {
display: inline-block;
padding-left: 0.5em;
cursor: pointer;
}
ul.ColVis_collection li.ColVis_Special {
border-color: #555;
background: rgb(237,237,237); /* Old browsers */
background: -webkit-linear-gradient(top, rgba(237,237,237,1) 0%,rgba(214,214,214,1) 77%,rgba(232,232,232,1) 100%); /* Chrome10+,Safari5.1+ */
background: -moz-linear-gradient(top, rgba(237,237,237,1) 0%, rgba(214,214,214,1) 77%, rgba(232,232,232,1) 100%); /* FF3.6+ */
background: -ms-linear-gradient(top, rgba(237,237,237,1) 0%,rgba(214,214,214,1) 77%,rgba(232,232,232,1) 100%); /* IE10+ */
background: -o-linear-gradient(top, rgba(237,237,237,1) 0%,rgba(214,214,214,1) 77%,rgba(232,232,232,1) 100%); /* Opera 11.10+ */
background: linear-gradient(to bottom, rgba(237,237,237,1) 0%,rgba(214,214,214,1) 77%,rgba(232,232,232,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ededed', endColorstr='#e8e8e8',GradientType=0 ); /* IE6-9 */
}
ul.ColVis_collection li.ColVis_Special:hover {
background: #e2e2e2; /* Old browsers */
background: -webkit-linear-gradient(top, #d0d0d0 0%,#d5d5d5 89%,#e2e2e2 100%); /* Chrome10+,Safari5.1+ */
background: -moz-linear-gradient(top, #d0d0d0 0%,#d5d5d5 89%,#e2e2e2 100%); /* FF3.6+ */
background: -ms-linear-gradient(top, #d0d0d0 0%,#d5d5d5 89%,#e2e2e2 100%); /* IE10+ */
background: -o-linear-gradient(top, #d0d0d0 0%,#d5d5d5 89%,#e2e2e2 100%); /* Opera 11.10+ */
background: linear-gradient(top, #d0d0d0 0%,#d5d5d5 89%,#e2e2e2 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f3f3f3', endColorstr='#e2e2e2',GradientType=0 ); /* IE6-9 */
}
span.ColVis_radio {
display: inline-block;
width: 20px;
}
div.ColVis_catcher {
position: absolute;
z-index: 1101;
}
.disabled {
color: #999;
}
div.ColVis{float:right;margin-bottom:1em}button.ColVis_Button,ul.ColVis_collection li{position:relative;float:left;margin-right:3px;padding:5px 8px;border:1px solid #999;cursor:pointer;*cursor:hand;font-size:0.88em;color:black !important;white-space:nowrap;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px;border-radius:2px;-webkit-box-shadow:1px 1px 3px #ccc;-moz-box-shadow:1px 1px 3px #ccc;-ms-box-shadow:1px 1px 3px #ccc;-o-box-shadow:1px 1px 3px #ccc;box-shadow:1px 1px 3px #ccc;background:#ffffff;background:-webkit-linear-gradient(top, #fff 0%, #f3f3f3 89%, #f9f9f9 100%);background:-moz-linear-gradient(top, #fff 0%, #f3f3f3 89%, #f9f9f9 100%);background:-ms-linear-gradient(top, #fff 0%, #f3f3f3 89%, #f9f9f9 100%);background:-o-linear-gradient(top, #fff 0%, #f3f3f3 89%, #f9f9f9 100%);background:linear-gradient(top, #fff 0%, #f3f3f3 89%, #f9f9f9 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 )}.ColVis_Button:hover,ul.ColVis_collection li:hover{border:1px solid #666;text-decoration:none !important;-webkit-box-shadow:1px 1px 3px #999;-moz-box-shadow:1px 1px 3px #999;-ms-box-shadow:1px 1px 3px #999;-o-box-shadow:1px 1px 3px #999;box-shadow:1px 1px 3px #999;background:#f3f3f3;background:-webkit-linear-gradient(top, #f3f3f3 0%, #e2e2e2 89%, #f4f4f4 100%);background:-moz-linear-gradient(top, #f3f3f3 0%, #e2e2e2 89%, #f4f4f4 100%);background:-ms-linear-gradient(top, #f3f3f3 0%, #e2e2e2 89%, #f4f4f4 100%);background:-o-linear-gradient(top, #f3f3f3 0%, #e2e2e2 89%, #f4f4f4 100%);background:linear-gradient(top, #f3f3f3 0%, #e2e2e2 89%, #f4f4f4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3f3f3', endColorstr='#f4f4f4',GradientType=0 )}button.ColVis_Button{height:30px;padding:3px 8px}button.ColVis_Button::-moz-focus-inner{border:none !important;padding:0}button.ColVis_Button:active{outline:none}div.ColVis_collectionBackground{position:fixed;top:0;left:0;height:100%;width:100%;background-color:black;z-index:1100}ul.ColVis_collection{width:150px;padding:8px 8px 4px 8px;margin:0;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.4);background-color:#f3f3f3;background-color:rgba(255,255,255,0.3);overflow:hidden;z-index:2002;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px;border-radius:5px;-webkit-box-shadow:3px 3px 5px rgba(0,0,0,0.3);-moz-box-shadow:3px 3px 5px rgba(0,0,0,0.3);-ms-box-shadow:3px 3px 5px rgba(0,0,0,0.3);-o-box-shadow:3px 3px 5px rgba(0,0,0,0.3);box-shadow:3px 3px 5px rgba(0,0,0,0.3)}ul.ColVis_collection li{position:relative;height:auto;left:0;right:0;padding:0.5em;display:block;float:none;margin-bottom:4px;-webkit-box-shadow:1px 1px 3px #999;-moz-box-shadow:1px 1px 3px #999;-ms-box-shadow:1px 1px 3px #999;-o-box-shadow:1px 1px 3px #999;box-shadow:1px 1px 3px #999}ul.ColVis_collection li{text-align:left}ul.ColVis_collection li.ColVis_Button:hover{border:1px solid #999;background-color:#f0f0f0}ul.ColVis_collection li span{display:inline-block;padding-left:0.5em;cursor:pointer}ul.ColVis_collection li.ColVis_Special{border-color:#555;background:#ededed;background:-webkit-linear-gradient(top, #ededed 0%, #d6d6d6 77%, #e8e8e8 100%);background:-moz-linear-gradient(top, #ededed 0%, #d6d6d6 77%, #e8e8e8 100%);background:-ms-linear-gradient(top, #ededed 0%, #d6d6d6 77%, #e8e8e8 100%);background:-o-linear-gradient(top, #ededed 0%, #d6d6d6 77%, #e8e8e8 100%);background:linear-gradient(to bottom, #ededed 0%, #d6d6d6 77%, #e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#e8e8e8',GradientType=0 )}ul.ColVis_collection li.ColVis_Special:hover{background:#e2e2e2;background:-webkit-linear-gradient(top, #d0d0d0 0%, #d5d5d5 89%, #e2e2e2 100%);background:-moz-linear-gradient(top, #d0d0d0 0%, #d5d5d5 89%, #e2e2e2 100%);background:-ms-linear-gradient(top, #d0d0d0 0%, #d5d5d5 89%, #e2e2e2 100%);background:-o-linear-gradient(top, #d0d0d0 0%, #d5d5d5 89%, #e2e2e2 100%);background:linear-gradient(top, #d0d0d0 0%, #d5d5d5 89%, #e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3f3f3', endColorstr='#e2e2e2',GradientType=0 )}span.ColVis_radio{display:inline-block;width:20px}div.ColVis_catcher{position:absolute;z-index:1101}.disabled{color:#999}
button.ColVis_Button,
ul.ColVis_collection li {
padding: 0.5em;
}
ul.ColVis_collection {
margin: 0;
padding: 0;
}
ul.ColVis_collection li {
clear: both;
display: block;
text-align: left;
margin: -1px 0 0 0;
}
ul.ColVis_collection li span {
display: inline-block;
padding-left: 0.5em;
cursor: pointer;
}
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<title>ColVis examples - ColVis examples</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>ColVis example <span>ColVis examples</span></h1>
<div class="info">
<p>ColVis adds a button to the toolbars around DataTables which gives the end user of the table the
ability to dynamically change the visibility of the columns in the table:</p>
<ul class="markdown">
<li>Dynamically show and hide columns in a table</li>
<li>Very easy integration with DataTables</li>
<li>Ability to exclude columns from being either hidden or shown</li>
<li>Save saving integration with DataTables</li>
</ul>
</div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<div class="toc">
<div class="toc-group">
<h3><a href="./index.html">Examples</a></h3>
<ul class="toc">
<li><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./new_init.html">`new` initialisation</a></li>
<li><a href="./text.html">Custom button text</a></li>
<li><a href="./exclude_columns.html">Exclude columns from list</a></li>
<li><a href="./title_callback.html">Column button callback</a></li>
<li><a href="./button_order.html">Button ordering</a></li>
<li><a href="./mouseover.html">Mouseover activation</a></li>
<li><a href="./group_columns.html">Group columns</a></li>
<li><a href="./two_tables.html">Two tables with individual controls</a></li>
<li><a href="./two_tables_identical.html">Two tables with shared controls</a></li>
<li><a href="./restore.html">Restore / show all</a></li>
<li><a href="./jqueryui.html">jQuery UI styling</a></li>
</ul>
</div>
</div>
<div class="epilogue">
<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
information about its API properties and methods.<br>
Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
<a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
DataTables.</p>
<p class="copyright">DataTables designed and created by <a href=
"http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
</div>
</div>
</div>
</section>
</body>
</html>
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<title>ColVis example - Two tables with individual controls</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.colVis.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
<style type="text/css" class="init">
</style>
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="../js/dataTables.colVis.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<script type="text/javascript" language="javascript" class="init">
$(document).ready(function() {
$('table.display').DataTable( {
dom: 'C<"clear">lfrtip',
displayLength: 5
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>ColVis example <span>Two tables with individual controls</span></h1>
<div class="info">
<p>It can be useful to have DataTables initialise more than one table with a single call can for them
to each have individual ColVis controllers. All this requires is a suitable jQuery selector to be used,
and DataTables and ColVis will take care of the rest - as shown in this example.</p>
</div>
<table id="" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>$320,800</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>$433,060</td>
</tr>
<tr>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>$103,600</td>
</tr>
<tr>
<td>Quinn Flynn</td>
<td>Support Lead</td>
<td>Edinburgh</td>
<td>22</td>
<td>$342,000</td>
</tr>
<tr>
<td>Dai Rios</td>
<td>Personnel Lead</td>
<td>Edinburgh</td>
<td>35</td>
<td>$217,500</td>
</tr>
<tr>
<td>Gavin Joyce</td>
<td>Developer</td>
<td>Edinburgh</td>
<td>42</td>
<td>$92,575</td>
</tr>
<tr>
<td>Martena Mccray</td>
<td>Post-Sales support</td>
<td>Edinburgh</td>
<td>46</td>
<td>$324,050</td>
</tr>
<tr>
<td>Jennifer Acosta</td>
<td>Junior Javascript Developer</td>
<td>Edinburgh</td>
<td>43</td>
<td>$75,650</td>
</tr>
<tr>
<td>Shad Decker</td>
<td>Regional Director</td>
<td>Edinburgh</td>
<td>51</td>
<td>$183,000</td>
</tr>
</tbody>
</table>
<table id="" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Jena Gaines</td>
<td>Office Manager</td>
<td>London</td>
<td>30</td>
<td>$90,560</td>
</tr>
<tr>
<td>Haley Kennedy</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>43</td>
<td>$313,500</td>
</tr>
<tr>
<td>Tatyana Fitzpatrick</td>
<td>Regional Director</td>
<td>London</td>
<td>19</td>
<td>$385,750</td>
</tr>
<tr>
<td>Michael Silva</td>
<td>Marketing Designer</td>
<td>London</td>
<td>66</td>
<td>$198,500</td>
</tr>
<tr>
<td>Bradley Greer</td>
<td>Software Engineer</td>
<td>London</td>
<td>41</td>
<td>$132,000</td>
</tr>
<tr>
<td>Angelica Ramos</td>
<td>Chief Executive Officer (CEO)</td>
<td>London</td>
<td>47</td>
<td>$1,200,000</td>
</tr>
<tr>
<td>Suki Burks</td>
<td>Developer</td>
<td>London</td>
<td>53</td>
<td>$114,500</td>
</tr>
<tr>
<td>Prescott Bartlett</td>
<td>Technical Author</td>
<td>London</td>
<td>27</td>
<td>$145,000</td>
</tr>
<tr>
<td>Timothy Mooney</td>
<td>Office Manager</td>
<td>London</td>
<td>37</td>
<td>$136,200</td>
</tr>
<tr>
<td>Bruno Nash</td>
<td>Software Engineer</td>
<td>London</td>
<td>38</td>
<td>$163,500</td>
</tr>
<tr>
<td>Hermione Butler</td>
<td>Regional Director</td>
<td>London</td>
<td>47</td>
<td>$356,250</td>
</tr>
<tr>
<td>Lael Greer</td>
<td>Systems Administrator</td>
<td>London</td>
<td>21</td>
<td>$103,500</td>
</tr>
</tbody>
</table>
<ul class="tabs">
<li class="active">Javascript</li>
<li>HTML</li>
<li>CSS</li>
<li>Ajax</li>
<li>Server-side script</li>
</ul>
<div class="tabs">
<div class="js">
<p>The Javascript shown below is used to initialise the table shown in this
example:</p><code class="multiline brush: js;">$(document).ready(function() {
$('table.display').DataTable( {
dom: 'C&lt;&quot;clear&quot;&gt;lfrtip',
displayLength: 5
} );
} );</code>
<p>In addition to the above code, the following Javascript library files are loaded for use in this
example:</p>
<ul>
<li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
<li><a href=
"../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
<li><a href="../js/dataTables.colVis.js">../js/dataTables.colVis.js</a></li>
</ul>
</div>
<div class="table">
<p>The HTML shown below is the raw HTML table element, before it has been enhanced by
DataTables:</p>
</div>
<div class="css">
<div>
<p>This example uses a little bit of additional CSS beyond what is loaded from the library
files (below), in order to correctly display the table. The additional CSS used is shown
below:</p><code class="multiline brush: js;"></code>
</div>
<p>The following CSS library files are loaded for use in this example to provide the styling of the
table:</p>
<ul>
<li><a href=
"../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
<li><a href="../css/dataTables.colVis.css">../css/dataTables.colVis.css</a></li>
</ul>
</div>
<div class="ajax">
<p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
will update automatically as any additional data is loaded.</p>
</div>
<div class="php">
<p>The script used to perform the server-side processing for this table is shown below. Please note
that this is just an example script using PHP. Server-side processing scripts can be written in any
language, using <a href="//datatables.net/manual/server-side">the protocol described in the
DataTables documentation</a>.</p>
</div>
</div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<h2>Other examples</h2>
<div class="toc">
<div class="toc-group">
<h3><a href="./index.html">Examples</a></h3>
<ul class="toc active">
<li><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./new_init.html">`new` initialisation</a></li>
<li><a href="./text.html">Custom button text</a></li>
<li><a href="./exclude_columns.html">Exclude columns from list</a></li>
<li><a href="./title_callback.html">Column button callback</a></li>
<li><a href="./button_order.html">Button ordering</a></li>
<li><a href="./mouseover.html">Mouseover activation</a></li>
<li><a href="./group_columns.html">Group columns</a></li>
<li class="active"><a href="./two_tables.html">Two tables with individual controls</a></li>
<li><a href="./two_tables_identical.html">Two tables with shared controls</a></li>
<li><a href="./restore.html">Restore / show all</a></li>
<li><a href="./jqueryui.html">jQuery UI styling</a></li>
</ul>
</div>
</div>
<div class="epilogue">
<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
information about its API properties and methods.<br>
Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
<a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
DataTables.</p>
<p class="copyright">DataTables designed and created by <a href=
"http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
</div>
</div>
</div>
</section>
</body>
</html>
\ No newline at end of file \ No newline at end of file
/*!
ColVis 1.1.0
©2010-2014 SpryMedia Ltd - datatables.net/license
*/
(function(j,i,k){j=function(d){var e=function(a,b){(!this.CLASS||"ColVis"!=this.CLASS)&&alert("Warning: ColVis must be initialised with the keyword 'new'");"undefined"==typeof b&&(b={});d.fn.dataTable.camelToHungarian&&d.fn.dataTable.camelToHungarian(e.defaults,b);this.s={dt:null,oInit:b,hidden:!0,abOriginal:[]};this.dom={wrapper:null,button:null,collection:null,background:null,catcher:null,buttons:[],groupButtons:[],restore:null};e.aInstances.push(this);this.s.dt=d.fn.dataTable.Api?(new d.fn.dataTable.Api(a)).settings()[0]:
a;this._fnConstruct(b);return this};e.prototype={button:function(){return this.dom.wrapper},fnRebuild:function(){this.rebuild()},rebuild:function(){for(var a=this.dom.buttons.length-1;0<=a;a--)this.dom.collection.removeChild(this.dom.buttons[a]);this.dom.buttons.splice(0,this.dom.buttons.length);this.dom.restore&&this.dom.restore.parentNode(this.dom.restore);this._fnAddGroups();this._fnAddButtons();this._fnDrawCallback()},_fnConstruct:function(a){this._fnApplyCustomisation(a);var b=this,c,f;this.dom.wrapper=
i.createElement("div");this.dom.wrapper.className="ColVis";this.dom.button=d("<button />",{"class":!this.s.dt.bJUI?"ColVis_Button ColVis_MasterButton":"ColVis_Button ColVis_MasterButton ui-button ui-state-default"}).append("<span>"+this.s.buttonText+"</span>").bind("mouseover"==this.s.activate?"mouseover":"click",function(a){a.preventDefault();b._fnCollectionShow()}).appendTo(this.dom.wrapper)[0];this.dom.catcher=this._fnDomCatcher();this.dom.collection=this._fnDomCollection();this.dom.background=
this._fnDomBackground();this._fnAddGroups();this._fnAddButtons();c=0;for(f=this.s.dt.aoColumns.length;c<f;c++)this.s.abOriginal.push(this.s.dt.aoColumns[c].bVisible);this.s.dt.aoDrawCallback.push({fn:function(){b._fnDrawCallback.call(b)},sName:"ColVis"});d(this.s.dt.oInstance).bind("column-reorder",function(a,d,e){c=0;for(f=b.s.aiExclude.length;c<f;c++)b.s.aiExclude[c]=e.aiInvertMapping[b.s.aiExclude[c]];a=b.s.abOriginal.splice(e.iFrom,1)[0];b.s.abOriginal.splice(e.iTo,0,a);b.fnRebuild()});this._fnDrawCallback()},
_fnApplyCustomisation:function(a){d.extend(!0,this.s,e.defaults,a);!this.s.showAll&&this.s.bShowAll&&(this.s.showAll=this.s.sShowAll);!this.s.restore&&this.s.bRestore&&(this.s.restore=this.s.sRestore);var a=this.s.groups,b=this.s.aoGroups;if(a)for(var c=0,f=a.length;c<f;c++)if(a[c].title&&(b[c].sTitle=a[c].title),a[c].columns)b[c].aiColumns=a[c].columns},_fnDrawCallback:function(){for(var a=this.s.dt.aoColumns,b=this.dom.buttons,c=this.s.aoGroups,f,g=0,h=b.length;g<h;g++)f=b[g],f.__columnIdx!==k&&
d("input",f).prop("checked",a[f.__columnIdx].bVisible);b=0;for(f=c.length;b<f;b++){a:{for(var g=c[b].aiColumns,h=0,e=g.length;h<e;h++)if(!1===a[g[h]].bVisible){g=!1;break a}g=!0}if(g)d("input",this.dom.groupButtons[b]).prop("checked",!0),d("input",this.dom.groupButtons[b]).prop("indeterminate",!1);else{a:{g=c[b].aiColumns;h=0;for(e=g.length;h<e;h++)if(!0===a[g[h]].bVisible){g=!1;break a}g=!0}g?(d("input",this.dom.groupButtons[b]).prop("checked",!1),d("input",this.dom.groupButtons[b]).prop("indeterminate",
!1)):d("input",this.dom.groupButtons[b]).prop("indeterminate",!0)}}},_fnAddGroups:function(){var a;if("undefined"!=typeof this.s.aoGroups)for(var b=0,c=this.s.aoGroups.length;b<c;b++)a=this._fnDomGroupButton(b),this.dom.groupButtons.push(a),this.dom.buttons.push(a),this.dom.collection.appendChild(a)},_fnAddButtons:function(){var a,b=this.s.dt.aoColumns;if(-1===d.inArray("all",this.s.aiExclude))for(var c=0,f=b.length;c<f;c++)-1===d.inArray(c,this.s.aiExclude)&&(a=this._fnDomColumnButton(c),a.__columnIdx=
c,this.dom.buttons.push(a));"alpha"===this.s.order&&this.dom.buttons.sort(function(a,c){var d=b[a.__columnIdx].sTitle,f=b[c.__columnIdx].sTitle;return d===f?0:d<f?-1:1});this.s.restore&&(a=this._fnDomRestoreButton(),a.className+=" ColVis_Restore",this.dom.buttons.push(a));this.s.showAll&&(a=this._fnDomShowAllButton(),a.className+=" ColVis_ShowAll",this.dom.buttons.push(a));d(this.dom.collection).append(this.dom.buttons)},_fnDomRestoreButton:function(){var a=this;return d('<li class="ColVis_Special '+
(this.s.dt.bJUI?"ui-button ui-state-default":"")+'">'+this.s.restore+"</li>").click(function(){for(var b=0,c=a.s.abOriginal.length;b<c;b++)a.s.dt.oInstance.fnSetColumnVis(b,a.s.abOriginal[b],!1);a._fnAdjustOpenRows();a.s.dt.oInstance.fnAdjustColumnSizing(!1);a.s.dt.oInstance.fnDraw(!1)})[0]},_fnDomShowAllButton:function(){var a=this;return d('<li class="ColVis_Special '+(this.s.dt.bJUI?"ui-button ui-state-default":"")+'">'+this.s.showAll+"</li>").click(function(){for(var b=0,c=a.s.abOriginal.length;b<
c;b++)-1===a.s.aiExclude.indexOf(b)&&a.s.dt.oInstance.fnSetColumnVis(b,!0,!1);a._fnAdjustOpenRows();a.s.dt.oInstance.fnAdjustColumnSizing(!1);a.s.dt.oInstance.fnDraw(!1)})[0]},_fnDomGroupButton:function(a){var b=this,c=this.s.aoGroups[a];return d('<li class="ColVis_Special '+(this.s.dt.bJUI?"ui-button ui-state-default":"")+'"><label><input type="checkbox" /><span>'+c.sTitle+"</span></label></li>").click(function(a){var g=!d("input",this).is(":checked");"li"!==a.target.nodeName.toLowerCase()&&(g=!g);
for(a=0;a<c.aiColumns.length;a++)b.s.dt.oInstance.fnSetColumnVis(c.aiColumns[a],g)})[0]},_fnDomColumnButton:function(a){var b=this,c=this.s.dt.aoColumns[a],f=this.s.dt,c=null===this.s.fnLabel?c.sTitle:this.s.fnLabel(a,c.sTitle,c.nTh);return d("<li "+(f.bJUI?'class="ui-button ui-state-default"':"")+'><label><input type="checkbox" /><span>'+c+"</span></label></li>").click(function(c){var e=!d("input",this).is(":checked");"li"!==c.target.nodeName.toLowerCase()&&(e=!e);c=d.fn.dataTableExt.iApiIndex;d.fn.dataTableExt.iApiIndex=
b._fnDataTablesApiIndex.call(b);f.oFeatures.bServerSide?(b.s.dt.oInstance.fnSetColumnVis(a,e,!1),b.s.dt.oInstance.fnAdjustColumnSizing(!1),(""!==f.oScroll.sX||""!==f.oScroll.sY)&&b.s.dt.oInstance.oApi._fnScrollDraw(b.s.dt),b._fnDrawCallback()):b.s.dt.oInstance.fnSetColumnVis(a,e);d.fn.dataTableExt.iApiIndex=c;null!==b.s.fnStateChange&&b.s.fnStateChange.call(b,a,e)})[0]},_fnDataTablesApiIndex:function(){for(var a=0,b=this.s.dt.oInstance.length;a<b;a++)if(this.s.dt.oInstance[a]==this.s.dt.nTable)return a;
return 0},_fnDomCollection:function(){return d("<ul />",{"class":!this.s.dt.bJUI?"ColVis_collection":"ColVis_collection ui-buttonset ui-buttonset-multi"}).css({display:"none",opacity:0,position:!this.s.bCssPosition?"absolute":""})[0]},_fnDomCatcher:function(){var a=this,b=i.createElement("div");b.className="ColVis_catcher";d(b).click(function(){a._fnCollectionHide.call(a,null,null)});return b},_fnDomBackground:function(){var a=this,b=d("<div></div>").addClass("ColVis_collectionBackground").css("opacity",
0).click(function(){a._fnCollectionHide.call(a,null,null)});"mouseover"==this.s.activate&&b.mouseover(function(){a.s.overcollection=!1;a._fnCollectionHide.call(a,null,null)});return b[0]},_fnCollectionShow:function(){var a=this,b;b=d(this.dom.button).offset();var c=this.dom.collection,f=this.dom.background,e=parseInt(b.left,10),h=parseInt(b.top+d(this.dom.button).outerHeight(),10);this.s.bCssPosition||(c.style.top=h+"px",c.style.left=e+"px");d(c).css({display:"block",opacity:0});f.style.bottom="0px";
f.style.right="0px";h=this.dom.catcher.style;h.height=d(this.dom.button).outerHeight()+"px";h.width=d(this.dom.button).outerWidth()+"px";h.top=b.top+"px";h.left=e+"px";i.body.appendChild(f);i.body.appendChild(c);i.body.appendChild(this.dom.catcher);d(c).animate({opacity:1},a.s.iOverlayFade);d(f).animate({opacity:0.1},a.s.iOverlayFade,"linear",function(){d.browser&&(d.browser.msie&&d.browser.version=="6.0")&&a._fnDrawCallback()});this.s.bCssPosition||(b="left"==this.s.sAlign?e:e-d(c).outerWidth()+
d(this.dom.button).outerWidth(),c.style.left=b+"px",f=d(c).outerWidth(),d(c).outerHeight(),e=d(i).width(),b+f>e&&(c.style.left=e-f+"px"));this.s.hidden=!1},_fnCollectionHide:function(){var a=this;!this.s.hidden&&null!==this.dom.collection&&(this.s.hidden=!0,d(this.dom.collection).animate({opacity:0},a.s.iOverlayFade,function(){this.style.display="none"}),d(this.dom.background).animate({opacity:0},a.s.iOverlayFade,function(){i.body.removeChild(a.dom.background);i.body.removeChild(a.dom.catcher)}))},
_fnAdjustOpenRows:function(){for(var a=this.s.dt.aoOpenRows,b=this.s.dt.oApi._fnVisbleColumns(this.s.dt),c=0,d=a.length;c<d;c++)a[c].nTr.getElementsByTagName("td")[0].colSpan=b}};e.fnRebuild=function(a){var b=null;"undefined"!=typeof a&&(b=a.fnSettings().nTable);for(var c=0,d=e.aInstances.length;c<d;c++)("undefined"==typeof a||b==e.aInstances[c].s.dt.nTable)&&e.aInstances[c].fnRebuild()};e.defaults={active:"click",buttonText:"Show / hide columns",aiExclude:[],bRestore:!1,sRestore:"Restore original",
bShowAll:!1,sShowAll:"Show All",sAlign:"left",fnStateChange:null,iOverlayFade:500,fnLabel:null,bCssPosition:!1,aoGroups:[],order:"column"};e.aInstances=[];e.prototype.CLASS="ColVis";e.VERSION="1.1.0";e.prototype.VERSION=e.VERSION;"function"==typeof d.fn.dataTable&&"function"==typeof d.fn.dataTableExt.fnVersionCheck&&d.fn.dataTableExt.fnVersionCheck("1.7.0")?d.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var b=a.oInit;return(new e(a,b.colVis||b.oColVis||{})).button()},cFeature:"C",sFeature:"ColVis"}):
alert("Warning: ColVis requires DataTables 1.7 or greater - www.datatables.net/download");d.fn.dataTable.ColVis=e;return d.fn.DataTable.ColVis=e};"function"===typeof define&&define.amd?define("datatables-colvis",["jquery","datatables"],j):jQuery&&!jQuery.fn.dataTable.ColVis&&j(jQuery,jQuery.fn.dataTable)})(window,document);
# FixedColumns
When making use of DataTables' x-axis scrolling feature (`scrollX`), you may wish to fix the left or right most columns in place. This plug-in for DataTables provides exactly this option (for non-scrolling tables, please use the FixedHeader plug-in, which can fix headers, footers and columns). Key features include:
* Freezes the left most column to the side of the table
* Option to freeze two or more columns
* Full integration with DataTables' scrolling options
# Installation
To use FixedColumns, first download DataTables ( http://datatables.net/download ) and place the unzipped FixedColumns package into a `extensions` directory in the DataTables package. This will allow the pages in the examples to operate correctly. To see the examples running, open the `examples` directory in your web-browser.
# Basic usage
FixedColumns is initialised using the `$.fn.dataTable.FixedColumns()` constructor. For example:
```js
$(document).ready(function() {
var table = $('#example').DataTable( {
scrollY: "300px",
scrollX: true,
scrollCollapse: true,
paging: false
} );
new $.fn.dataTable.FixedColumns( table );
} );
```
# Documentation / support
* Documentation: http://datatables.net/extensions/FixedColumns/
* DataTables support forums: http://datatables.net/forums
# GitHub
If you fancy getting involved with the development of FixedColumns and help make it better, please refer to its GitHub repo: https://github.com/DataTables/FixedColumns
/* Block out what is behind the fixed column's header and footer */
table.DTFC_Cloned thead,
table.DTFC_Cloned tfoot {
background-color: white;
}
/* Block out the gap above the scrollbar on the right, when there is a fixed
* right column
*/
div.DTFC_Blocker {
background-color: white;
}
div.DTFC_LeftWrapper table.dataTable,
div.DTFC_RightWrapper table.dataTable {
margin-bottom: 0;
}
div.DTFC_LeftWrapper table.dataTable.no-footer,
div.DTFC_RightWrapper table.dataTable.no-footer {
border-bottom: none;
}
table.DTFC_Cloned thead,table.DTFC_Cloned tfoot{background-color:white}div.DTFC_Blocker{background-color:white}div.DTFC_LeftWrapper table.dataTable,div.DTFC_RightWrapper table.dataTable{margin-bottom:0}div.DTFC_LeftWrapper table.dataTable.no-footer,div.DTFC_RightWrapper table.dataTable.no-footer{border-bottom:none}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<title>FixedColumns examples - FixedColumns examples</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>FixedColumns example <span>FixedColumns examples</span></h1>
<div class="info">
<p>When making use of DataTables' x-axis scrolling feature (<a href=
"//datatables.net/reference/option/scrollX"><code class="option" title=
"DataTables initialisation option">scrollX<span>DT</span></code></a>), you may wish to fix the left or
right most columns in place. This extension for DataTables provides exactly this option (for
non-scrolling tables, please use the <a href="//datatables.net/extensions/fixedheader">FixedHeader
extension</a>, which can fix headers, footers and columns). Key features include:</p>
<ul class="markdown">
<li>Freezes the left most column to the side of the table</li>
<li>Option to freeze two or more columns</li>
<li>Full integration with DataTables' scrolling options</li>
</ul>
</div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<div class="toc">
<div class="toc-group">
<h3><a href="./index.html">Examples</a></h3>
<ul class="toc">
<li><a href="./left_right_columns.html">Left and right fixed columns</a></li>
<li><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./two_columns.html">Multiple fixed columns</a></li>
<li><a href="./right_column.html">Right column only</a></li>
<li><a href="./rowspan.html">Complex headers</a></li>
<li><a href="./colvis.html">ColVis integration</a></li>
<li><a href="./server-side-processing.html">Server-side processing</a></li>
<li><a href="./css_size.html">CSS row sizing</a></li>
<li><a href="./size_fixed.html">Assigned column width</a></li>
<li><a href="./size_fluid.html">Fluid column width</a></li>
<li><a href="./col_filter.html">Individual column filtering</a></li>
<li><a href="./bootstrap.html">Bootstrap</a></li>
<li><a href="./index_column.html">Index column</a></li>
</ul>
</div>
</div>
<div class="epilogue">
<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
information about its API properties and methods.<br>
Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
<a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
DataTables.</p>
<p class="copyright">DataTables designed and created by <a href=
"http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
</div>
</div>
</div>
</section>
</body>
</html>
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
<title>FixedColumns example - Server-side processing</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.fixedColumns.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
<style type="text/css" class="init">
/* Ensure that the demo table scrolls */
th, td { white-space: nowrap; }
div.dataTables_wrapper {
width: 600px;
margin: 0 auto;
}
/* Lots of padding for the cells as SSP has limited data in the demo */
th,
td {
padding-left: 40px !important;
padding-right: 40px !important;
}
</style>
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="../js/dataTables.fixedColumns.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<script type="text/javascript" language="javascript" class="init">
$(document).ready(function() {
var table = $('#example').DataTable( {
scrollY: "300px",
scrollX: true,
scrollCollapse: true,
ajax: "../../../examples/server_side/scripts/server_processing.php",
serverSide: true
} );
new $.fn.dataTable.FixedColumns( table );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>FixedColumns example <span>Server-side processing</span></h1>
<div class="info">
<p>This example shows how FixedColumns can be used with server-side processing in DataTables to cope
with very large tables. No special considerations are required, just initialise FixedColumns as you
normally would!</p>
<p>Note that the table width is constrained in this example to allow scrolling to occur as the
server-side processing data set has a limited number of columns in this demo!</p>
</div>
<table id="example" class="stripe row-border order-column" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>
<ul class="tabs">
<li class="active">Javascript</li>
<li>HTML</li>
<li>CSS</li>
<li>Ajax</li>
<li>Server-side script</li>
</ul>
<div class="tabs">
<div class="js">
<p>The Javascript shown below is used to initialise the table shown in this
example:</p><code class="multiline brush: js;">$(document).ready(function() {
var table = $('#example').DataTable( {
scrollY: &quot;300px&quot;,
scrollX: true,
scrollCollapse: true,
ajax: &quot;../../../examples/server_side/scripts/server_processing.php&quot;,
serverSide: true
} );
new $.fn.dataTable.FixedColumns( table );
} );</code>
<p>In addition to the above code, the following Javascript library files are loaded for use in this
example:</p>
<ul>
<li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
<li><a href=
"../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
<li><a href="../js/dataTables.fixedColumns.js">../js/dataTables.fixedColumns.js</a></li>
</ul>
</div>
<div class="table">
<p>The HTML shown below is the raw HTML table element, before it has been enhanced by
DataTables:</p>
</div>
<div class="css">
<div>
<p>This example uses a little bit of additional CSS beyond what is loaded from the library
files (below), in order to correctly display the table. The additional CSS used is shown
below:</p><code class="multiline brush: js;">/* Ensure that the demo table scrolls */
th, td { white-space: nowrap; }
div.dataTables_wrapper {
width: 600px;
margin: 0 auto;
}
/* Lots of padding for the cells as SSP has limited data in the demo */
th,
td {
padding-left: 40px !important;
padding-right: 40px !important;
}</code>
</div>
<p>The following CSS library files are loaded for use in this example to provide the styling of the
table:</p>
<ul>
<li><a href=
"../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
<li><a href="../css/dataTables.fixedColumns.css">../css/dataTables.fixedColumns.css</a></li>
</ul>
</div>
<div class="ajax">
<p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
will update automatically as any additional data is loaded.</p>
</div>
<div class="php">
<p>The script used to perform the server-side processing for this table is shown below. Please note
that this is just an example script using PHP. Server-side processing scripts can be written in any
language, using <a href="//datatables.net/manual/server-side">the protocol described in the
DataTables documentation</a>.</p>
</div>
</div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<h2>Other examples</h2>
<div class="toc">
<div class="toc-group">
<h3><a href="./index.html">Examples</a></h3>
<ul class="toc active">
<li><a href="./left_right_columns.html">Left and right fixed columns</a></li>
<li><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./two_columns.html">Multiple fixed columns</a></li>
<li><a href="./right_column.html">Right column only</a></li>
<li><a href="./rowspan.html">Complex headers</a></li>
<li><a href="./colvis.html">ColVis integration</a></li>
<li class="active"><a href="./server-side-processing.html">Server-side processing</a></li>
<li><a href="./css_size.html">CSS row sizing</a></li>
<li><a href="./size_fixed.html">Assigned column width</a></li>
<li><a href="./size_fluid.html">Fluid column width</a></li>
<li><a href="./col_filter.html">Individual column filtering</a></li>
<li><a href="./bootstrap.html">Bootstrap</a></li>
<li><a href="./index_column.html">Index column</a></li>
</ul>
</div>
</div>
<div class="epilogue">
<p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
information about its API properties and methods.<br>
Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
<a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
DataTables.</p>
<p class="copyright">DataTables designed and created by <a href=
"http://www.sprymedia.co.uk">SpryMedia Ltd</a> &#169; 2007-2014<br>
DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>
</div>
</div>
</div>
</section>
</body>
</html>
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!