Commit 23423855 by xueli.xue

init

parent 9a5b01ed
Showing with 3469 additions and 3199 deletions
......@@ -5,7 +5,25 @@ git.osc地址:http://git.oschina.net/xuxueli0323/xxl-job
博客地址(内附使用教程):http://www.cnblogs.com/xuxueli/p/5021979.html
# 基于quartz封装实现的的集群任务调度管理平台
1、简单:支持通过Web页面对任务进行CRUD操作,操作简单,一分钟上手
2、动态:支持动态修改任务状态,动态暂停/恢复任务,即时生效.
3、集群:任务信息持久化到mysql中,支持Job服务器集群(高可用),一个任务只会在其中一台服务器上执行
# 特点:基于quartz封装实现的的集群任务调度管理平台
1、简单:支持通过Web页面对任务进行CRUD操作,操作简单,一分钟上手;
2、动态:支持动态修改任务状态,动态暂停/恢复任务,即时生效;
3、服务HA:任务信息持久化到mysql中,Job服务天然支持集群,保证服务HA;
4、任务HA:某台Job服务挂掉,任务会平滑分配给其他的某一台存活服务,即使所有服务挂掉,重启时或补偿执行丢失任务;
5、一个任务只会在其中一台服务器上执行;
6、任务串行执行;
7、支持任务执行日志;
8、支持自定义参数;
# 新版本 V1.2.x :架构模块化 【开发中...】
说明:V1.2版本将系统架构按功能拆分为:
调度模块[xxl-job-admin]:负责管理调度信息,按照调度配置发出调度请求;
任务模块[xxl-job-client-demo]:负责接收调度请求并执行任务逻辑;任务模块可以方便的嵌入web项目,可以参考此demo;
通讯模块[xxl-job-client]:负责调度模块和任务模块之间的信息通讯;
优点:
解耦:任务模块提供任务接口,调度模块维护调度信息,业务相互独立;
高扩展性;
稳定性;
Tips:如果您追求一个简单调度服务,这里也提供了一个简洁分支[xxl-job-simple],它针对旧版调度框架做了细微完善;
## dianping-job[任务调度平台]
分层: 调度和任务拆分, 支持动态扩充, 管理任务
1. 调度模块:dianping-job-web, 维护任务的调度信息,负责定时/周期性的发出调度请求.
2. 任务模块:dianping-job-client, 具体的任务逻辑,负责接收调度模块的调度请求,执行任务逻辑.
3. 通讯模块:dianping-job-client, 负责调度模块和任务模块之间的通讯.
说明:
1. 调度模块集群部署[HA].
2. 任务串行执行.
3. 记录调度日系.
\ No newline at end of file
log4j.rootLogger=info,console,logFile
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d - dianping-job-web - %p [%c] - <%m>%n
log4j.appender.logFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logFile.File=${catalina.base}/logs/dianping-job-web.log
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
log4j.appender.logFile.layout.ConversionPattern=%d - dianping-job-web - %p [%c] - <%m>%n
#
# Quartz seems to work best with the driver mm.mysql-2.0.7-bin.jar
#
# PLEASE consider using mysql with innodb tables to avoid locking issues
#
# In your Quartz properties file, you'll need to set
# org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE;
DROP TABLE IF EXISTS QRTZ_LOCKS;
DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_TRIGGERS;
DROP TABLE IF EXISTS QRTZ_JOB_DETAILS;
DROP TABLE IF EXISTS QRTZ_CALENDARS;
CREATE TABLE QRTZ_JOB_DETAILS
(
SCHED_NAME VARCHAR(120) NOT NULL,
JOB_NAME VARCHAR(200) NOT NULL,
JOB_GROUP VARCHAR(200) NOT NULL,
DESCRIPTION VARCHAR(250) NULL,
JOB_CLASS_NAME VARCHAR(250) NOT NULL,
IS_DURABLE VARCHAR(1) NOT NULL,
IS_NONCONCURRENT VARCHAR(1) NOT NULL,
IS_UPDATE_DATA VARCHAR(1) NOT NULL,
REQUESTS_RECOVERY VARCHAR(1) NOT NULL,
JOB_DATA BLOB NULL,
PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
);
CREATE TABLE QRTZ_TRIGGERS
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
JOB_NAME VARCHAR(200) NOT NULL,
JOB_GROUP VARCHAR(200) NOT NULL,
DESCRIPTION VARCHAR(250) NULL,
NEXT_FIRE_TIME BIGINT(13) NULL,
PREV_FIRE_TIME BIGINT(13) NULL,
PRIORITY INTEGER NULL,
TRIGGER_STATE VARCHAR(16) NOT NULL,
TRIGGER_TYPE VARCHAR(8) NOT NULL,
START_TIME BIGINT(13) NOT NULL,
END_TIME BIGINT(13) NULL,
CALENDAR_NAME VARCHAR(200) NULL,
MISFIRE_INSTR SMALLINT(2) NULL,
JOB_DATA BLOB NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
);
CREATE TABLE QRTZ_SIMPLE_TRIGGERS
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
REPEAT_COUNT BIGINT(7) NOT NULL,
REPEAT_INTERVAL BIGINT(12) NOT NULL,
TIMES_TRIGGERED BIGINT(10) NOT NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE QRTZ_CRON_TRIGGERS
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
CRON_EXPRESSION VARCHAR(200) NOT NULL,
TIME_ZONE_ID VARCHAR(80),
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE QRTZ_SIMPROP_TRIGGERS
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
STR_PROP_1 VARCHAR(512) NULL,
STR_PROP_2 VARCHAR(512) NULL,
STR_PROP_3 VARCHAR(512) NULL,
INT_PROP_1 INT NULL,
INT_PROP_2 INT NULL,
LONG_PROP_1 BIGINT NULL,
LONG_PROP_2 BIGINT NULL,
DEC_PROP_1 NUMERIC(13,4) NULL,
DEC_PROP_2 NUMERIC(13,4) NULL,
BOOL_PROP_1 VARCHAR(1) NULL,
BOOL_PROP_2 VARCHAR(1) NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE QRTZ_BLOB_TRIGGERS
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
BLOB_DATA BLOB NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE QRTZ_CALENDARS
(
SCHED_NAME VARCHAR(120) NOT NULL,
CALENDAR_NAME VARCHAR(200) NOT NULL,
CALENDAR BLOB NOT NULL,
PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
);
CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS
(
SCHED_NAME VARCHAR(120) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
);
CREATE TABLE QRTZ_FIRED_TRIGGERS
(
SCHED_NAME VARCHAR(120) NOT NULL,
ENTRY_ID VARCHAR(95) NOT NULL,
TRIGGER_NAME VARCHAR(200) NOT NULL,
TRIGGER_GROUP VARCHAR(200) NOT NULL,
INSTANCE_NAME VARCHAR(200) NOT NULL,
FIRED_TIME BIGINT(13) NOT NULL,
SCHED_TIME BIGINT(13) NOT NULL,
PRIORITY INTEGER NOT NULL,
STATE VARCHAR(16) NOT NULL,
JOB_NAME VARCHAR(200) NULL,
JOB_GROUP VARCHAR(200) NULL,
IS_NONCONCURRENT VARCHAR(1) NULL,
REQUESTS_RECOVERY VARCHAR(1) NULL,
PRIMARY KEY (SCHED_NAME,ENTRY_ID)
);
CREATE TABLE QRTZ_SCHEDULER_STATE
(
SCHED_NAME VARCHAR(120) NOT NULL,
INSTANCE_NAME VARCHAR(200) NOT NULL,
LAST_CHECKIN_TIME BIGINT(13) NOT NULL,
CHECKIN_INTERVAL BIGINT(13) NOT NULL,
PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
);
CREATE TABLE QRTZ_LOCKS
(
SCHED_NAME VARCHAR(120) NOT NULL,
LOCK_NAME VARCHAR(40) NOT NULL,
PRIMARY KEY (SCHED_NAME,LOCK_NAME)
);
commit;
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dianping</groupId>
<artifactId>dianping-job</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>dianping-job-web</module>
<module>dianping-job-client</module>
<module>dianping-job-client-demo</module>
</modules>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
......@@ -3,10 +3,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxl</groupId>
<artifactId>xxl-job</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>xxl-job-admin</module>
<module>xxl-job-client</module>
<module>xxl-job-client-demo</module>
<module>xxl-job-simple</module>
</modules>
<build>
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>xxl-job-admin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry excluding="**/*.min.js|**/node_modules/*|**/bower_components/*" kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
eclipse.preferences.version=1
encoding//src/main/java=UTF8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="xxl-job-admin">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="xxl-job-client-1.1.2-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/xxl-job-client/xxl-job-client">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="xxl-job-admin"/>
<property name="java-output-path" value="/xxl-job-admin/target/classes"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
disabled=06target
eclipse.preferences.version=1
......@@ -4,11 +4,12 @@
<parent>
<groupId>com.xxl</groupId>
<artifactId>xxl-job</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
</parent>
<artifactId>xxl-job-admin</artifactId>
<version>1.1.2-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<spring.version>3.2.14.RELEASE</spring.version>
</properties>
......@@ -128,13 +129,20 @@
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
<!-- xxl-mq-core
<!-- httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<!-- xxl-job-client -->
<dependency>
<groupId>com.xxl</groupId>
<artifactId>xxl-job-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>xxl-job-client</artifactId>
<version>1.1.2-SNAPSHOT</version>
</dependency>
-->
</dependencies>
......
package com.dianping.job.controller;
package com.xxl.job.controller;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
......@@ -18,10 +18,10 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.dianping.job.client.handler.HandlerRepository;
import com.dianping.job.core.model.ReturnT;
import com.dianping.job.core.util.DynamicSchedulerUtil;
import com.dianping.job.service.job.HttpJobBean;
import com.xxl.job.client.handler.HandlerRepository;
import com.xxl.job.core.model.ReturnT;
import com.xxl.job.core.util.DynamicSchedulerUtil;
import com.xxl.job.service.job.HttpJobBean;
/**
* index controller
......
package com.dianping.job.core.model;
package com.xxl.job.core.model;
import java.util.Date;
/**
* dianping job log, used to track trigger process
* xxl-job log, used to track trigger process
* @author xuxueli 2015-12-19 23:19:09
*/
public class DianpingJobLog {
public class XxlJobLog {
private String jobTriggerUuid;
private String jobHandleName;
......@@ -70,7 +70,7 @@ public class DianpingJobLog {
@Override
public String toString() {
return "DianpingJobLog [jobTriggerUuid=" + jobTriggerUuid + ", jobHandleName=" + jobHandleName
return "XxlJobLog [jobTriggerUuid=" + jobTriggerUuid + ", jobHandleName=" + jobHandleName
+ ", triggerTime=" + triggerTime + ", triggerStatus=" + triggerStatus + ", triggerDetailLog="
+ triggerDetailLog + ", handleTime=" + handleTime + ", handleStatus=" + handleStatus
+ ", handleDetailLog=" + handleDetailLog + "]";
......
package com.dianping.job.service.impl;
package com.xxl.job.service.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.dianping.job.service.ITriggerService;
import com.xxl.job.service.ITriggerService;
/**
* local trigger, only exists in local jvm
......@@ -15,7 +15,7 @@ public class TriggerServiceImpl implements ITriggerService {
private static transient Logger logger = LoggerFactory.getLogger(TriggerServiceImpl.class);
public void beat() {
logger.info(">>>>>>>>>>> dianping-clock beat success.");
logger.info(">>>>>>>>>>> xxl-job beat success.");
}
}
package com.dianping.job.service.job;
package com.xxl.job.service.job;
import java.io.IOException;
import java.io.PrintWriter;
......@@ -27,10 +27,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;
import com.dianping.job.client.handler.HandlerRepository;
import com.dianping.job.client.handler.IJobHandler.JobTriggerStatus;
import com.dianping.job.core.model.DianpingJobLog;
import com.dianping.job.core.util.DynamicSchedulerUtil;
import com.xxl.job.client.handler.HandlerRepository;
import com.xxl.job.client.handler.IJobHandler.JobTriggerStatus;
import com.xxl.job.core.model.XxlJobLog;
import com.xxl.job.core.util.DynamicSchedulerUtil;
/**
* http job bean
......@@ -58,17 +58,17 @@ public class HttpJobBean extends QuartzJobBean {
String job_url = params.get(DynamicSchedulerUtil.job_url);
triggerPost(job_url, params);
logger.info(">>>>>>>>>>> dianping-clock run :jobId:{}, group:{}, jobDataMap:{}",
logger.info(">>>>>>>>>>> xxl-job run :jobId:{}, group:{}, jobDataMap:{}",
new Object[]{triggerKey, triggerGroup, jobDataMap});
}
public static void triggerPost(String reqURL, Map<String, String> params){
// save log
DianpingJobLog jobLog = new DianpingJobLog();
XxlJobLog jobLog = new XxlJobLog();
jobLog.setJobTriggerUuid(UUID.randomUUID().toString());
jobLog.setJobHandleName(params.get(HandlerRepository.handleName));
jobLog.setTriggerTime(new Date());
logger.info(">>>>>>>>>>> dianping-clock trigger start :jobLog:{}", jobLog);
logger.info(">>>>>>>>>>> xxl-job trigger start :jobLog:{}", jobLog);
// post
String responseContent = null;
......@@ -91,7 +91,7 @@ public class HttpJobBean extends QuartzJobBean {
responseContent = EntityUtils.toString(entity, "UTF-8");
EntityUtils.consume(entity);
}
logger.info(">>>>>>>>>>> dianping-clock trigger ing :jobLog:{}, response:{}, responseContent:{}", jobLog, response, responseContent);
logger.info(">>>>>>>>>>> xxl-job trigger ing :jobLog:{}, response:{}, responseContent:{}", jobLog, response, responseContent);
} catch (Exception e) {
e.printStackTrace();
......@@ -117,17 +117,17 @@ public class HttpJobBean extends QuartzJobBean {
jobLog.setTriggerDetailLog(jobLog.getTriggerDetailLog().substring(0, 1000));
}
logger.info(">>>>>>>>>>> dianping-clock trigger end :jobLog:{}", jobLog);
logger.info(">>>>>>>>>>> xxl-job trigger end :jobLog:{}", jobLog);
}
}
public static void main(String[] args) {
String url = "http://localhost:8080/dianping-job-client-demo/dianpingJobServlet";
String url = "http://localhost:8080/xxl-job-client-demo/xxlJobServlet";
for (int i = 0; i < 3; i++) {
Map<String, String> params = new HashMap<String, String>();
params.put(HandlerRepository.handleName, "com.dianping.job.service.handler.DemoJobHandler");
params.put(HandlerRepository.handleName, "com.xxl.job.service.handler.DemoJobHandler");
params.put(HandlerRepository.triggerUuid, i+"");
params.put("key", i+"");
......
......@@ -10,7 +10,7 @@
http://www.springframework.org/schema/util/spring-util.xsd">
<context:annotation-config />
<context:component-scan base-package="com.xxl.service.impl, com.xxl.dao.impl" />
<context:component-scan base-package="com.xxl.job.service" />
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/WEB-INF/template/" />
......@@ -19,11 +19,6 @@
<property name="location" value="classpath:freemarker.properties" />
</bean>
</property>
<property name="freemarkerVariables">
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="classpath:freemarker.variables.properties" />
</bean>
</property>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
......
......@@ -15,7 +15,6 @@
<context:annotation-config />
<context:component-scan base-package="com.xxl.service.impl, com.xxl.dao.impl" />
<!-- c3p0:Main数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${c3p0.driverClass}" />
<property name="jdbcUrl" value="${c3p0.url}" />
......@@ -35,7 +34,7 @@
<property name="mapperLocations" value="classpath*:com/xxl/core/model/mapper/*.xml"/>
</bean>
<!-- Template在Junit测试的时候,必须使用scope="prototype",原因未知 -->
<!-- scope must be "prototype" when junit -->
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
<constructor-arg index="0" ref="sqlSessionFactory" />
</bean>
......
......@@ -9,37 +9,16 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!-- Job trigger -->
<bean id="job02Trigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" >
<bean class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="com.xxl.service.job.JobDetailDemo"/>
<property name="jobDataAsMap">
<map>
<!-- <entry key="xxService" value-ref="xxService" /> -->
</map>
</property>
<property name="durability" value="true" />
</bean>
</property>
<property name="cronExpression" value="0/3 * * * * ? *" />
</bean>
<!-- Job信息会被上报并持久化到mysql中,多个集群节点中竞争Job锁,只会有一台执行 -->
<bean id="quartzScheduler" lazy-init="false" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="autoStartup" value="true" />
<property name="applicationContextSchedulerContextKey" value="applicationContextKey" />
<property name="configLocation" value="classpath:quartz.properties"/>
<property name="triggers">
<list>
<!-- <ref bean="job02Trigger" /> -->
</list>
</property>
</bean>
<!-- 调度器 -->
<bean id="dynamicSchedulerUtil" class="com.xxl.quartz.DynamicSchedulerUtil">
<!-- 协同-调度器 -->
<bean id="dynamicSchedulerUtil" class="com.xxl.job.core.util.DynamicSchedulerUtil">
<!-- (轻易不要变更“调度器名称”, 任务创建时会绑定该“调度器名称”) -->
<property name="scheduler" ref="quartzScheduler"/>
</bean>
......
......@@ -20,11 +20,11 @@
<property name="cronExpression" value="0/10 * * * * ? *" />
</bean>
<!-- Job被加载到内存中,每个集群节点相互独立,都会执行该任务 -->
<bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<!-- 进程-调度器 -->
<bean name="jvmQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="beatTrigger" />
<!-- <ref bean="beatTrigger" /> -->
</list>
</property>
</bean>
......
......@@ -12,15 +12,12 @@
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- 事务管理器(声明式事务) -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 启动事务注解(方式1:注解方式) -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<!-- 事务通知(方式2:XML事务管理) -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="detail*" propagation="SUPPORTS" />
......@@ -33,11 +30,8 @@
</tx:attributes>
</tx:advice>
<!-- AOP配置 -->
<aop:config>
<!-- 定义一个切入点 -->
<aop:pointcut id="txoperation" expression="execution(* com.xxl.service.imp.*.*(..))" />
<!-- 切入点事务通知 -->
<aop:advisor pointcut-ref="txoperation" advice-ref="txAdvice" />
</aop:config>
......
log4j.rootLogger=info,console
log4j.rootLogger=info,console,logFile
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d - xxl-job-demo - %p [%c] - <%m>%n
log4j.appender.console.layout.ConversionPattern=%d - xxl-job-admin - %p [%c] - <%m>%n
log4j.appender.logFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logFile.File=${catalina.base}/logs/xxl-job-demo.log
log4j.appender.logFile.File=${catalina.base}/logs/xxl-job-admin.log
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
log4j.appender.logFile.layout.ConversionPattern=%d - xxl-job-demo - %p [%c] - <%m>%n
log4j.appender.logFile.layout.ConversionPattern=%d - xxl-job-admin - %p [%c] - <%m>%n
......@@ -18,6 +18,7 @@ org.quartz.jobStore.misfireThreshold: 60000
#org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
# for cluster
#org.quartz.jobStore.tablePrefix = WED_qrtz_
org.quartz.scheduler.instanceId: AUTO
org.quartz.jobStore.class: org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.isClustered: true
......
......@@ -18,34 +18,35 @@
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<description>Spring-web MVC配置</description>
<mvc:annotation-driven />
<context:component-scan base-package="com.xxl.controller" />
<context:component-scan base-package="com.xxl.job.controller" />
<mvc:resources mapping="/favicon.ico" location="/favicon.ico" />
<mvc:resources mapping="/static/**" location="/static/" /> <!-- 不拦截static目录下 -->
<mvc:resources mapping="/**/*.html" location="/" /> <!-- 不拦截.html后缀 -->
<mvc:resources mapping="/static/**" location="/static/" />
<mvc:resources mapping="/**/*.html" location="/" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" /> <!-- 解析视图模板类 -->
<property name="prefix" value="" /> <!-- 模板前后缀,指定html页面为模板 -->
<property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" />
<property name="prefix" value="" />
<property name="suffix" value=".ftl" />
<property name="contentType" value="text/html;charset=UTF-8" /> <!-- 模板输出内容编码 (此处应与defaultEncoding保持一致) -->
<property name="exposeSpringMacroHelpers" value="true" /> <!-- 访问Request/Session宏助手 -->
<property name="exposeRequestAttributes" value="true" /> <!-- 允许访问Request属性,默认为false -->
<property name="exposeSessionAttributes" value="true" /> <!-- 允许访问Session属性,默认为false -->
<property name="requestContextAttribute" value="request" /> <!-- 将HttpServletRequest的属性存放到request这个变量中 -->
<property name="contentType" value="text/html;charset=UTF-8" />
<property name="exposeSpringMacroHelpers" value="true" />
<property name="exposeRequestAttributes" value="true" />
<property name="exposeSessionAttributes" value="true" />
<property name="requestContextAttribute" value="request" />
<property name="cache" value="true" />
<property name="order" value="0" />
</bean>
<!-- <mvc:interceptors>
<!--
// 自定义拦截器,支持SSO登陆拦截
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.xxl.controller.interceptor.PermissionInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
<bean id="exceptionResolver" class="com.xxl.controller.resolver.WebExceptionResolver" /> -->
<bean id="exceptionResolver" class="com.xxl.controller.resolver.WebExceptionResolver" />
-->
</beans>
\ No newline at end of file
......@@ -37,8 +37,6 @@
<script src="${request.contextPath}/static/adminlte/plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="${request.contextPath}/static/adminlte/dist/js/app.min.js"></script>
<!-- SlimScroll 1.3.0 -->
<script src="${request.contextPath}/static/adminlte/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- scrollup -->
<script src="${request.contextPath}/static/plugins/scrollup/jquery.scrollUp.min.js"></script>
......@@ -47,81 +45,15 @@
<#macro commonHeader>
<header class="main-header">
<!-- Logo -->
<a href="${request.contextPath}/" class="logo"> <!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>X</b>XL</span> <!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>调度</b>中心</span>
<a href="${request.contextPath}/" class="logo">
<span class="logo-mini"><b>X</b>XL</span>
<span class="logo-lg"><b>任务调度</b>中心</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">切换导航</span></a>
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- 通知: style can be found in dropdown.less -->
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell-o"></i> <span class="label label-warning">5</span></a>
<ul class="dropdown-menu">
<li class="header">您有5条通知</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个不错的应用
</a></li>
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个很不错的应用
</a></li>
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个非常不错的应用
</a></li>
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个非常非常不错的应用
</a></li>
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个非常非常非常不错的应用
</a></li>
</ul>
</li>
<li class="footer"><a href="#">查看全部</a></li>
</ul>
</li>
<!-- 账号: style can be found in dropdown.less -->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-user text-aqua"></i><span class="hidden-xs">${loginIdentity.userName}</span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<p>
${loginIdentity.realName} - 前端研发
<small>注册于 2012-11-20</small>
</p>
</li>
<!-- Menu Body
<li class="user-body">
<div class="col-xs-4 text-center"><a href="#">Followers</a></div>
<div class="col-xs-4 text-center"><a href="#">Sales</a></div>
<div class="col-xs-4 text-center"><a href="#">Friends</a></div>
</li>-->
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left"><a href="#" class="btn btn-default btn-flat">资料</a></div>
<div class="pull-right"><a href="javascript:;" class="btn btn-default btn-flat" id="logoutBtn" >注销</a></div>
</li>
</ul></li>
<!-- Control Sidebar Toggle Button -->
<li><a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a></li>
</ul>
</div>
<div class="navbar-custom-menu"></div>
</nav>
</header>
</#macro>
<#macro commonLeft>
......@@ -131,20 +63,9 @@
<section class="sidebar">
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header">常用模块</li>
<li class="nav-click" ><a href="${request.contextPath}/job/index"><i class="fa fa-circle-o text-red"></i> <span>调度管理</span></a></li>
<li class="nav-click" ><a href="${request.contextPath}/job/help"><i class="fa fa-circle-o text-yellow"></i><span>使用教程</span></a></li>
<li class="header">全部模块</li>
<li class="treeview nav-click">
<a href="#"><i class="fa fa-dashboard"></i> <span>调度中心</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<li class="nav-click" ><a href="${request.contextPath}/job/index"><i class="fa fa-circle-o"></i>调度管理</a></li>
<li class="nav-click" ><a href="${request.contextPath}/job/help"><i class="fa fa-circle-o"></i>使用教程</a></li>
</ul>
</li>
<li class="nav-click" ><a href="${request.contextPath}//"><i class="fa fa-circle-o text-red"></i> <span>调度中心</span></a></li>
<li class="nav-click" ><a href="${request.contextPath}/help"><i class="fa fa-circle-o text-yellow"></i><span>使用教程</span></a></li>
</ul>
</section>
<!-- /.sidebar -->
......@@ -234,8 +155,8 @@
<b>Version</b> 1.0
</div>
<strong>Copyright &copy; 2015-2015 &nbsp;
<a href="https://github.com/xuxueli/" target="_blank" >github</a>&nbsp;
<a href="http://www.cnblogs.com/xuxueli/" target="_blank" >cnblog</a>.
<a href="https://github.com/xuxueli/xxl-job" target="_blank" >github</a>&nbsp;
<a href="http://www.cnblogs.com/xuxueli/p/5021979.html" target="_blank" >cnblog</a>.
</strong> All rights reserved.
</footer>
</#macro>
......
<!DOCTYPE html>
<html>
<head>
<title>AdminLTE 2 | Dashboard</title>
<title>调度中心</title>
<#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle />
</head>
......@@ -26,18 +26,41 @@
<!-- Main content -->
<section class="content">
<div class="callout callout-info">
<h4>简介:xxl-job</h4>
<p>调度管理平台:基于quartz封装实现的的集群任务调度管理平台.</p>
<h4>简介:XXL_JOB</h4>
<p>基于quartz封装实现的的集群任务调度管理平台.</p>
<p></p>
</div>
<div class="callout callout-info">
<div class="callout callout-default">
<h4>特点:</h4>
<p>1、简单:支持通过Web页面对任务进行CRUD操作,操作简单,一分钟上手.</p>
<p>2、动态:支持动态修改任务状态,动态暂停/恢复任务,即时生效.</p>
<p>3、集群:任务信息持久化到mysql中,支持Job服务器集群(高可用),一个任务只会在其中一台服务器上执行.</p>
</div>
<div class="callout callout-default">
<h4>分层模型:</h4>
<p>1、基础:基于quartz封装底层调度层,通过CORN自定义任务执行周期,最终执行自定义JobBean的execute方法,如需多个任务,需要开发多个JobBean实现.</p>
<p>2、分层:上述基础调度模型存在一定局限,调度层和任务层耦合,当新任务上线势必影响任务的正常调度,因此规划将调度系统分层为:调度层 + 任务层 + 通讯层.</p>
<p>
<div class="row">
<div class="col-xs-offset-1 col-xs-11">
<p>》调度模块:维护任务的调度信息,负责定时/周期性的发出调度请求.</p>
<p>》任务模块:具体的任务逻辑,负责接收调度模块的调度请求,执行任务逻辑.</p>
<p>》通讯模块:负责调度模块和任务模块之间的通讯.</p>
<p>(总而言之,一条完整任务由 “调度信息” 和 “任务信息” 组成.)</p>
</div>
</div>
</p>
</div>
<div class="callout callout-default">
<h4>调度属性解析 : 发出HTTP调度请求</h4>
<p>1、调度Key【必填】:调度信息的全局唯一标识.</p>
<p>2、调度Corn【必填】:调度执行的时间表达式.</p>
<p>3、调度描述【必填】:调度的简述.</p>
<p>4、调度URL【必填】:调度执行时发出HTTP请求的目标URL地址.</p>
<p>5、+args【选填】:调度执行时发出HTTP请求的附带的POST参数.</p>
</div>
</section>
<!-- /.content -->
</div>
......
......@@ -19,10 +19,10 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>使用教程<small>调度管理平台</small></h1>
<h1>调度中心<small>调度管理</small></h1>
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>调度中心</a></li>
<li class="active">使用教程</li>
<li class="active">调度管理</li>
</ol>
</section>
......@@ -32,17 +32,17 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">任务列表</h3>
<button class="btn btn-primary btn-xs add" type="button">新增</button>
<h3 class="box-title">调度列表</h3>
<button class="btn btn-info btn-xs add" type="button">+新增任务</button>
</div>
<div class="box-body">
<table id="job_list" class="table table-bordered table-striped">
<thead>
<tr>
<th>任务ID</th>
<th>调度key</th>
<th>cron</th>
<th>Job类路径</th>
<th>简介</th>
<!--<th>类路径</th>-->
<th>参数</th>
<th>状态</th>
<th>操作</th>
</tr>
......@@ -53,11 +53,13 @@
<tr>
<td>${item['TriggerKey'].name}</td>
<td>${item['Trigger'].cronExpression}</td>
<td>${item['JobDetail'].jobClass}</td>
<!--<td>${item['JobDetail'].jobClass}</td>-->
<td>
<#if item['JobDetail'].jobDataMap?exists>
<#assign job_desc=item['JobDetail'].jobDataMap['job_desc'] />
${job_desc}
<#assign jobDataMap = item['JobDetail'].jobDataMap />
<#if jobDataMap?exists && jobDataMap?keys?size gt 0>
<#list jobDataMap?keys as key>
${key} = ${jobDataMap[key]} <br>
</#list>
</#if>
</td>
<td state="${item['TriggerState']}" >
......@@ -77,8 +79,9 @@
<#elseif item['TriggerState'] == 'PAUSED'>
<button class="btn btn-info btn-xs job_operate" type="job_resume" type="button">恢复</button>
</#if>
<button class="btn btn-info btn-xs update" type="button">修改</button>
<button class="btn btn-info btn-xs job_operate" type="job_trigger" type="button">执行一次</button>
<button class="btn btn-danger btn-xs job_operate" type="job_del" type="button">删除</button>
<button class="btn btn-info btn-xs update" type="button">更新corn</button>
</p>
</td>
</tr>
......@@ -87,10 +90,10 @@
</tbody>
<tfoot>
<tr>
<th>任务ID</th>
<th>调度key</th>
<th>cron</th>
<th>Job类路径</th>
<th>简介</th>
<!--<th>类路径</th>-->
<th>参数</th>
<th>状态</th>
<th>操作</th>
</tr>
......@@ -114,30 +117,35 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" >新增调度任务</h4>
<h4 class="modal-title" >新增调度信息</h4>
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">任务Key</label>
<div class="col-sm-10"><input type="text" class="form-control" name="triggerKeyName" placeholder="请输入任务Key" minlength="4" maxlength="100" ></div>
<label for="firstname" class="col-sm-3 control-label">任务Key</label>
<div class="col-sm-9"><input type="text" class="form-control" name="triggerKeyName" placeholder="请输入任务Key" minlength="4" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">任务Corn</label>
<div class="col-sm-10"><input type="text" class="form-control" name="cronExpression" placeholder="请输入任务Corn[允许修改]" maxlength="100" ></div>
<label for="lastname" class="col-sm-3 control-label">任务Corn</label>
<div class="col-sm-9"><input type="text" class="form-control" name="cronExpression" placeholder="请输入任务Corn[允许修改]" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">任务Impl</label>
<div class="col-sm-10"><input type="text" class="form-control" name="jobClassName" placeholder="请输入任务Impl[不支持修改]" maxlength="100" ></div>
<label for="lastname" class="col-sm-3 control-label">任务描述</label>
<div class="col-sm-9"><input type="text" class="form-control" name="job_desc" placeholder="请输入任务描述[不支持修改]" maxlength="200" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">任务描述</label>
<div class="col-sm-10"><input type="text" class="form-control" name="jobDesc" placeholder="请输入任务描述[不支持修改]" maxlength="200" ></div>
<label for="lastname" class="col-sm-3 control-label">任务URL</label>
<div class="col-sm-9"><input type="text" class="form-control" name="job_url" placeholder="请输入任务URL[不支持修改]" maxlength="200" ></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<label for="lastname" class="col-sm-3 control-label">任务handler</label>
<div class="col-sm-9"><input type="text" class="form-control" name="handleName" placeholder="请输入任务handler[不支持修改]" maxlength="200" ></div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<button type="submit" class="btn btn-primary" >保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-info pull-right addParam">+ arg</button>
</div>
</div>
</form>
......@@ -151,7 +159,7 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" >更新配置</h4>
<h4 class="modal-title" >更新corn</h4>
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
......@@ -164,14 +172,6 @@
<div class="col-sm-10"><input type="text" class="form-control" name="cronExpression" placeholder="请输入任务Corn" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">任务Impl</label>
<div class="col-sm-10"><input type="text" class="form-control" name="jobClassName" placeholder="请输入任务Impl" maxlength="100" readonly ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">任务描述</label>
<div class="col-sm-10"><input type="text" class="form-control" name="jobDesc" placeholder="请输入任务描述" maxlength="200" readonly ></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" >保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
......
......@@ -4,6 +4,10 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>xxl-job-admin</display-name>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>xxl-job-admin</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
......
div.FixedHeader_Cloned th,
div.FixedHeader_Cloned td {
background-color: white !important;
}
table.KeyTable th.focus,
table.KeyTable td.focus {
outline: 3px solid #3366FF;
outline-offset: -3px;
}
table.KeyTable th.focus,table.KeyTable td.focus{outline:3px solid #3366FF;outline-offset:-3px}
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child,
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child {
position: relative;
padding-left: 30px;
cursor: pointer;
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before {
top: 8px;
left: 4px;
height: 16px;
width: 16px;
display: block;
position: absolute;
color: white;
border: 2px solid white;
border-radius: 16px;
text-align: center;
line-height: 14px;
box-shadow: 0 0 3px #444;
box-sizing: content-box;
content: '+';
background-color: #31b131;
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child.dataTables_empty:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child.dataTables_empty:before {
display: none;
}
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before {
content: '-';
background-color: #d33333;
}
table.dataTable.dtr-inline.collapsed > tbody > tr.child td:before {
display: none;
}
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child,
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child {
padding-left: 27px;
}
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child:before,
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child:before {
top: 5px;
left: 4px;
height: 14px;
width: 14px;
border-radius: 14px;
line-height: 12px;
}
table.dataTable.dtr-column > tbody > tr > td.control,
table.dataTable.dtr-column > tbody > tr > th.control {
position: relative;
cursor: pointer;
}
table.dataTable.dtr-column > tbody > tr > td.control:before,
table.dataTable.dtr-column > tbody > tr > th.control:before {
top: 50%;
left: 50%;
height: 16px;
width: 16px;
margin-top: -10px;
margin-left: -10px;
display: block;
position: absolute;
color: white;
border: 2px solid white;
border-radius: 16px;
text-align: center;
line-height: 14px;
box-shadow: 0 0 3px #444;
box-sizing: content-box;
content: '+';
background-color: #31b131;
}
table.dataTable.dtr-column > tbody > tr.parent td.control:before,
table.dataTable.dtr-column > tbody > tr.parent th.control:before {
content: '-';
background-color: #d33333;
}
table.dataTable > tbody > tr.child {
padding: 0.5em 1em;
}
table.dataTable > tbody > tr.child:hover {
background: transparent !important;
}
table.dataTable > tbody > tr.child ul {
display: inline-block;
list-style-type: none;
margin: 0;
padding: 0;
}
table.dataTable > tbody > tr.child ul li {
border-bottom: 1px solid #efefef;
padding: 0.5em 0;
}
table.dataTable > tbody > tr.child ul li:first-child {
padding-top: 0;
}
table.dataTable > tbody > tr.child ul li:last-child {
border-bottom: none;
}
table.dataTable > tbody > tr.child span.dtr-title {
display: inline-block;
min-width: 75px;
font-weight: bold;
}
<!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="../../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"></script>
<title>Responsive examples - Child row control</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Responsive example <span>Child row control</span></h1>
<div class="info">
<p>When a column is removed from display by Responsive, the data is still available in the table and can be displayed in a DataTables <em>child row</em> (see
<a href="//datatables.net/reference/api/row().child()"><code class="api" title="DataTables API method">row().child()<span>DT</span></code></a>). By default
Responsive will show child row controls in the first column when the table has been collapsed, allowing the end user to show / hide the information from the hidden
columns.</p>
<p>Responsive has a number of options for display of the child rows:</p>
<ul class="markdown">
<li>If child row display is enabled: <a href="//datatables.net/extensions/responsive/reference/option/responsive.details"><code class="option" title=
"Responsive initialisation option">responsive.details<span>R</span></code></a></li>
<li>How the show / hide control is displayed: <a href="//datatables.net/extensions/responsive/reference/option/responsive.details.type"><code class="option"
title="Responsive initialisation option">responsive.details.type<span>R</span></code></a></li>
<li>How the child row is rendered: <a href="//datatables.net/extensions/responsive/reference/option/responsive.details.renderer"><code class="option" title=
"Responsive initialisation option">responsive.details.renderer<span>R</span></code></a></li>
</ul>
<p>This section shows examples of these options being used.</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">Child rows</a></h3>
<ul class="toc">
<li><a href="./disable-child-rows.html">Disable child rows</a></li>
<li><a href="./column-control.html">Column controlled child rows</a></li>
<li><a href="./right-column.html">Column control - right</a></li>
<li><a href="./whole-row-control.html">Whole row child row control</a></li>
<li><a href="./custom-renderer.html">Custom child row renderer</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-2015<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
<!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="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<title>Responsive examples - Responsive DataTables</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Responsive example <span>Responsive DataTables</span></h1>
<div class="info"></div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<div class="toc">
<div class="toc-group">
<h3><a href="./initialisation/index.html">Basic initialisation</a></h3>
<ul class="toc">
<li><a href="./initialisation/className.html">Class name</a></li>
<li><a href="./initialisation/option.html">Configuration option</a></li>
<li><a href="./initialisation/new.html">`new` constructor</a></li>
<li><a href="./initialisation/ajax.html">Ajax data</a></li>
<li><a href="./initialisation/default.html">Default initialisation</a></li>
</ul>
</div>
<div class="toc-group">
<h3><a href="./styling/index.html">Styling</a></h3>
<ul class="toc">
<li><a href="./styling/bootstrap.html">Bootstrap styling</a></li>
<li><a href="./styling/foundation.html">Foundation styling</a></li>
<li><a href="./styling/scrolling.html">Vertical scrolling</a></li>
<li><a href="./styling/compact.html">Compact styling</a></li>
</ul>
</div>
<div class="toc-group">
<h3><a href="./display-control/index.html">Display control</a></h3>
<ul class="toc">
<li><a href="./display-control/auto.html">Automatic column hiding</a></li>
<li><a href="./display-control/classes.html">Class control</a></li>
<li><a href="./display-control/init-classes.html">Assigned class control</a></li>
<li><a href="./display-control/fixedHeader.html">With FixedHeader</a></li>
<li><a href="./display-control/complexHeader.html">Complex headers (rowspan / colspan)</a></li>
</ul>
</div>
<div class="toc-group">
<h3><a href="./child-rows/index.html">Child rows</a></h3>
<ul class="toc">
<li><a href="./child-rows/disable-child-rows.html">Disable child rows</a></li>
<li><a href="./child-rows/column-control.html">Column controlled child rows</a></li>
<li><a href="./child-rows/right-column.html">Column control - right</a></li>
<li><a href="./child-rows/whole-row-control.html">Whole row child row control</a></li>
<li><a href="./child-rows/custom-renderer.html">Custom child row renderer</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-2015<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
<!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="../../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"></script>
<title>Responsive examples - Initialisation</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Responsive example <span>Initialisation</span></h1>
<div class="info">
<p>Responsive can be run on a DataTable in a number of different ways:</p>
<ul class="markdown">
<li>By adding the class <code>responsive</code> or <code>dt-responsive</code> to the <code class="tag" title="HTML tag">table</code></li>
<li>Using the <a href="//datatables.net/extensions/responsive/reference/option/responsive"><code class="option" title=
"Responsive initialisation option">responsive<span>R</span></code></a> option in the DataTables initialisation</li>
<li>Use the <code>$.fn.dataTable.Responsive</code> constructor.</li>
</ul>
<p>This set of examples demonstrates these initialisation options.</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">Basic initialisation</a></h3>
<ul class="toc">
<li><a href="./className.html">Class name</a></li>
<li><a href="./option.html">Configuration option</a></li>
<li><a href="./new.html">`new` constructor</a></li>
<li><a href="./ajax.html">Ajax data</a></li>
<li><a href="./default.html">Default initialisation</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-2015<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
<!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="../../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"></script>
<title>Responsive examples - Styling</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Responsive example <span>Styling</span></h1>
<div class="info">
<p>Responsive requires very little styling information of its own, with styling needed only for the child row display when the table has been collapsed. As such,
integrating Responsive with your application should be as simple as including the Javascript and base stylesheet! This section shows Responsive being styling using
external CSS frameworks.</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">Styling</a></h3>
<ul class="toc">
<li><a href="./bootstrap.html">Bootstrap styling</a></li>
<li><a href="./foundation.html">Foundation styling</a></li>
<li><a href="./scrolling.html">Vertical scrolling</a></li>
<li><a href="./compact.html">Compact 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-2015<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
# Scroller
Scroller is a virtual rendering plug-in for DataTables which allows large datasets to be drawn on screen every quickly. What the virtual rendering means is that only the visible portion of the table (and a bit to either side to make the scrolling smooth) is drawn, while the scrolling container gives the visual impression that the whole table is visible. This is done by making use of the pagination abilities of DataTables and moving the table around in the scrolling container DataTables adds to the page. The scrolling container is forced to the height it would be for the full table display using an extra element.
Key features include:
* Speed! The aim of Scroller for DataTables is to make rendering large data sets fast
* Full compatibility with DataTables' deferred rendering for maximum speed
* Integration with state saving in DataTables (scrolling position is saved)
* Support for scrolling with millions of rows
* Easy to use
# Installation
To use Scroller, first download DataTables ( http://datatables.net/download ) and place the unzipped Scroller 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
Scroller is initialised by simply including the letter `dt-string S` in the `dt-init dom` for the table you want to have this feature enabled on. Note that the `dt-string S` must come after the `dt-string t` parameter in `dom`. For example:
```js
$(document).ready( function () {
$('#example').DataTable( {
dom: 'lfrtipS'
} );
} );
```
Note that rows in the table must all be the same height. Information in a cell which expands on to multiple lines will cause some odd behaviour in the scrolling. Additionally, the table's `cellspacing` parameter must be set to 0, again to ensure the information display is correct.
# Documentation / support
* Documentation: http://datatables.net/extensions/scroller/
* DataTables support forums: http://datatables.net/forums
# GitHub
If you fancy getting involved with the development of Scroller and help make it better, please refer to its GitHub repo: https://github.com/DataTables/Scroller
<!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>Scroller example - API</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.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.scroller.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( {
ajax: "data/2500.txt",
deferRender: true,
dom: "frtiS",
scrollY: 200,
scrollCollapse: true,
initComplete: function () {
var api = this.api();
api.scroller().scrollToRow( 1000 );
}
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>API</span></h1>
<div class="info">
<p>This example shows a trivial use of the API methods that Scroller adds to the DataTables API to
scroll to a row once the table's data has been loaded. In this case
<code>scroller().scrollToRow()</code> is used to jump to row 1000.</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</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( {
ajax: &quot;data/2500.txt&quot;,
deferRender: true,
dom: &quot;frtiS&quot;,
scrollY: 200,
scrollCollapse: true,
initComplete: function () {
var api = this.api();
api.scroller().scrollToRow( 1000 );
}
} );
} );</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.scroller.js">../js/dataTables.scroller.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.scroller.css">../css/dataTables.scroller.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="./state_saving.html">State saving</a></li>
<li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li class="active"><a href="./api_scrolling.html">API</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
<!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>Scroller examples - Scroller examples</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>Scroller examples</span></h1>
<div class="info">
<p>Scroller is a virtual rendering plug-in for DataTables which allows large datasets to be drawn on
screen every quickly. What the virtual rendering means is that only the visible portion of the table
(and a bit to either side to make the scrolling smooth) is drawn, while the scrolling container gives
the visual impression that the whole table is visible. This is done by making use of the pagination
abilities of DataTables and moving the table around in the scrolling container DataTables adds to the
page. The scrolling container is forced to the height it would be for the full table display using an
extra element.</p>
<p>Scroller is initialised by simply including the letter <code>S</code> in the <a href=
"//datatables.net/reference/option/dom"><code class="option" title=
"DataTables initialisation option">dom<span>DT</span></code></a> for the table you want to have this
feature enabled on. Note that the <code>S</code> must come after the <code>t</code> parameter in
<a href="//datatables.net/reference/option/dom"><code class="option" title=
"DataTables initialisation option">dom<span>DT</span></code></a>.</p>
<p>Key features include:</p>
<ul class="markdown">
<li>Speed! The aim of Scroller for DataTables is to make rendering large data sets fast</li>
<li>Full compatibility with DataTables' deferred rendering for maximum speed</li>
<li>Integration with state saving in DataTables (scrolling position is saved)</li>
<li>Easy to use</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="./state_saving.html">State saving</a></li>
<li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li><a href="./api_scrolling.html">API</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
<!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>Scroller example - Client-side data source (50,000 rows)</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.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.scroller.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 data = [];
for ( var i=0 ; i<50000 ; i++ ) {
data.push( [ i, i, i, i, i ] );
}
var oTable = $('#example').dataTable( {
data: data,
deferRender: true,
dom: "frtiS",
scrollY: 200,
scrollCollapse: true
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>Client-side data source (50,000 rows)</span></h1>
<div class="info">
<p>This example is completely artificial in that the data generated is created on the client-side by
just looping around a Javascript array and then passing that to DataTables. However, it does show quite
nicely that DataTables and Scroller can cope with large amounts of data on the client-side quite
nicely. Typically data such as this would be Ajax sourced and server-side processing should be
considered.</p>
<p>Please be aware that the performance of this page will depend on your browser as the array of data
is generated - for example IE6 will crawl!</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</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 data = [];
for ( var i=0 ; i&lt;50000 ; i++ ) {
data.push( [ i, i, i, i, i ] );
}
var oTable = $('#example').dataTable( {
data: data,
deferRender: true,
dom: &quot;frtiS&quot;,
scrollY: 200,
scrollCollapse: true
} );
} );</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.scroller.js">../js/dataTables.scroller.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.scroller.css">../css/dataTables.scroller.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="./state_saving.html">State saving</a></li>
<li class="active"><a href="./large_js_source.html">Client-side data source (50,000
rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li><a href="./api_scrolling.html">API</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
<!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>Scroller example - Basic initialisation</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.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.scroller.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( {
ajax: "data/2500.txt",
deferRender: true,
dom: "frtiS",
scrollY: 200,
scrollCollapse: true
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>Basic initialisation</span></h1>
<div class="info">
<p>Scroller is a plug-in for DataTables which enhances DataTables' built-in scrolling features to allow
large amounts of data to be rendered on page very quickly. This is done by Scroller through the use of
a virtual rendering technique that will render only the part of the table that is actually required for
the current view.</p>
<p>Note that Scroller assumes that all rows are of the same height (in order to preform the required
calculations. You can use <code>td { white-space: nowrap; }</code> in your CSS to ensure that text in
rows does not wrap.</p>
<p>This example shows how Scroller for DataTables can be initialised by simply including the character
<code>S</code> in sDom (note that the <code>S</code> must come after the <code>t</code> in sDom).
Deferred rendering an and Ajax data source are also used in this example.</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</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( {
ajax: &quot;data/2500.txt&quot;,
deferRender: true,
dom: &quot;frtiS&quot;,
scrollY: 200,
scrollCollapse: true
} );
} );</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.scroller.js">../js/dataTables.scroller.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.scroller.css">../css/dataTables.scroller.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 class="active"><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./state_saving.html">State saving</a></li>
<li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li><a href="./api_scrolling.html">API</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
<!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>Scroller example - State saving</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.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.scroller.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( {
ajax: "data/2500.txt",
deferRender: true,
dom: "frtiS",
scrollY: 200,
scrollCollapse: true,
stateSave: true
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>State saving</span></h1>
<div class="info">
<p>Scroller will automatically integrate with DataTables in order to save the scrolling position of the
table, if state saving is enabled in the DataTable (<a href=
"//datatables.net/reference/option/stateSave"><code class="option" title=
"DataTables initialisation option">stateSave<span>DT</span></code></a>). This example shows that in
practice - to demonstrate, scroll the table and then reload the page.</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</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( {
ajax: &quot;data/2500.txt&quot;,
deferRender: true,
dom: &quot;frtiS&quot;,
scrollY: 200,
scrollCollapse: true,
stateSave: true
} );
} );</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.scroller.js">../js/dataTables.scroller.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.scroller.css">../css/dataTables.scroller.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 class="active"><a href="./state_saving.html">State saving</a></li>
<li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li><a href="./api_scrolling.html">API</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
div.DTTT_container{position:relative;float:right;margin-bottom:1em}@media screen and (max-width: 640px){div.DTTT_container{float:none !important;text-align:center}div.DTTT_container:after{visibility:hidden;display:block;content:"";clear:both;height:0}}button.DTTT_button,div.DTTT_button,a.DTTT_button{position:relative;display:inline-block;margin-right:3px;padding:5px 8px;border:1px solid #999;cursor:pointer;*cursor:hand;font-size:0.88em;color:black !important;-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 )}button.DTTT_button{height:30px;padding:3px 8px}.DTTT_button embed{outline:none}button.DTTT_button:hover:not(.DTTT_disabled),div.DTTT_button:hover:not(.DTTT_disabled),a.DTTT_button:hover:not(.DTTT_disabled){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.DTTT_button:focus,div.DTTT_button:focus,a.DTTT_button:focus{border:1px solid #426c9e;text-shadow:0 1px 0 #c4def1;outline:none;background-color:#a3d0ef 100%;background-image:-webkit-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);background-image:-moz-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);background-image:-ms-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);background-image:-o-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);background-image:linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#a3d0ef', EndColorStr='#a3d0ef')}button.DTTT_button:active:not(.DTTT_disabled),div.DTTT_button:active:not(.DTTT_disabled),a.DTTT_button:active:not(.DTTT_disabled){-webkit-box-shadow:inset 1px 1px 3px #999999;-moz-box-shadow:inset 1px 1px 3px #999999;box-shadow:inset 1px 1px 3px #999999}button.DTTT_disabled,div.DTTT_disabled,a.DTTT_disabled{color:#999 !important;border:1px solid #d0d0d0;cursor:default;background:#ffffff;background:-webkit-linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);background:-moz-linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);background:-ms-linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);background:-o-linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);background:linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#fafafa',GradientType=0 )}button.DTTT_button_collection span{padding-right:17px;background:url(../images/collection.png) no-repeat center right}button.DTTT_button_collection:hover span{padding-right:17px;background:#f0f0f0 url(../images/collection_hover.png) no-repeat center right}table.DTTT_selectable tbody tr{cursor:pointer;*cursor:hand}table.dataTable tr.DTTT_selected.odd{background-color:#9FAFD1}table.dataTable tr.DTTT_selected.odd td.sorting_1{background-color:#9FAFD1}table.dataTable tr.DTTT_selected.odd td.sorting_2{background-color:#9FAFD1}table.dataTable tr.DTTT_selected.odd td.sorting_3{background-color:#9FAFD1}table.dataTable tr.DTTT_selected.even{background-color:#B0BED9}table.dataTable tr.DTTT_selected.even td.sorting_1{background-color:#B0BED9}table.dataTable tr.DTTT_selected.even td.sorting_2{background-color:#B0BED9}table.dataTable tr.DTTT_selected.even td.sorting_3{background-color:#B0BED9}div.DTTT_collection{width:150px;padding:8px 8px 4px 8px;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)}div.DTTT_collection_background{background:black;z-index:2001}div.DTTT_collection button.DTTT_button,div.DTTT_collection div.DTTT_button,div.DTTT_collection a.DTTT_button{position:relative;left:0;right:0;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}.DTTT_print_info{position:fixed;top:50%;left:50%;width:400px;height:150px;margin-left:-200px;margin-top:-75px;text-align:center;color:#333;padding:10px 30px;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 );opacity:0.95;border:1px solid black;border:1px solid rgba(0,0,0,0.5);-webkit-border-radius:6px;-moz-border-radius:6px;-ms-border-radius:6px;-o-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.5);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.5);-ms-box-shadow:0 3px 7px rgba(0,0,0,0.5);-o-box-shadow:0 3px 7px rgba(0,0,0,0.5);box-shadow:0 3px 7px rgba(0,0,0,0.5)}.DTTT_print_info h6{font-weight:normal;font-size:28px;line-height:28px;margin:1em}.DTTT_print_info p{font-size:14px;line-height:20px}
<!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>TableTools examples - TableTools examples</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>TableTools example <span>TableTools examples</span></h1>
<div class="info">
<p>TableTools is a plug-in for the DataTables HTML table enhancer, which adds a highly customisable button toolbar to a DataTable. Key features include:</p>
<ul class="markdown">
<li>Copy to clipboard</li>
<li>Save table data as CSV, XLS or PDF files</li>
<li>Print view for clean printing</li>
<li>Row selection options</li>
<li>Easy use predefined buttons</li>
<li>Simple customisation of buttons</li>
<li>Well defined API for advanced control</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="./swf_path.html">Setting the SWF path</a></li>
<li><a href="./new_init.html">Initialisation with `new`</a></li>
<li><a href="./defaults.html">Defaults</a></li>
<li><a href="./select_single.html">Row selection - single row select</a></li>
<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
<li><a href="./select_os.html">Row selection - operating system style</a></li>
<li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multi_instance.html">Multiple toolbars</a></li>
<li><a href="./collection.html">Button collections</a></li>
<li><a href="./plug-in.html">Plug-in button types</a></li>
<li><a href="./button_text.html">Custom button text</a></li>
<li><a href="./alter_buttons.html">Button arrangement</a></li>
<li><a href="./ajax.html">Ajax loaded data</a></li>
<li><a href="./pdf_message.html">PDF message</a></li>
<li><a href="./bootstrap.html">Bootstrap styling</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-2015<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
<!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>TableTools example - Row selection - row selector on specific cells</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.css">
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.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">
tr td:first-child {
text-align: center;
}
tr td:first-child:before {
content: "\f096"; /* fa-square-o */
font-family: FontAwesome;
}
tr.selected td:first-child:before {
content: "\f046"; /* fa-check-square-o */
}
</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.tableTools.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( {
ajax: "../../../examples/ajax/data/objects.txt",
columns: [
{ data: null, defaultContent: '', orderable: false },
{ data: 'name' },
{ data: 'position' },
{ data: 'office' },
{ data: 'extn' },
{ data: 'start_date' },
{ data: 'salary' }
],
order: [ 1, 'asc' ],
dom: 'T<"clear">lfrtip',
tableTools: {
sRowSelect: 'os',
sRowSelector: 'td:first-child',
aButtons: [ 'select_all', 'select_none' ]
}
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>TableTools example <span>Row selection - row selector on specific cells</span></h1>
<div class="info">
<p>By default, TableTools' row selector option will register a row selection click on any part of the row. Although this is often desirable, you might wish at
times to limit the row selection to just a single column, or other elements in the row. This might be useful, for example, with <a href=
"//editor.datatables.net">Editor's</a> inline editing, so you don't select the row on click of a cell that is to be edited.</p>
<p>The <code>sRowSelector</code> method provides this ability, allowing a custom jQuery selector to be passed in. TableTools will use the parent row of any element
that is selected by the end user.</p>
<p>In this case, the row selector is attached to the cells in the first column of the table, and <a href="http://fortawesome.github.io/Font-Awesome">Font
Awesome</a> is used to display a checkbox indicating the selection state of the row, in addition to the row background colouring.</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
</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 language-js">$(document).ready(function() {
$('#example').DataTable( {
ajax: &quot;../../../examples/ajax/data/objects.txt&quot;,
columns: [
{ data: null, defaultContent: '', orderable: false },
{ data: 'name' },
{ data: 'position' },
{ data: 'office' },
{ data: 'extn' },
{ data: 'start_date' },
{ data: 'salary' }
],
order: [ 1, 'asc' ],
dom: 'T&lt;&quot;clear&quot;&gt;lfrtip',
tableTools: {
sRowSelect: 'os',
sRowSelector: 'td:first-child',
aButtons: [ 'select_all', 'select_none' ]
}
} );
} );</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.tableTools.js">../js/dataTables.tableTools.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 language-css">tr td:first-child {
text-align: center;
}
tr td:first-child:before {
content: &quot;\f096&quot;; /* fa-square-o */
font-family: FontAwesome;
}
tr.selected td:first-child:before {
content: &quot;\f046&quot;; /* fa-check-square-o */
}</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.tableTools.css">../css/dataTables.tableTools.css</a></li>
<li><a href=
"//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css">//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.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="./swf_path.html">Setting the SWF path</a></li>
<li><a href="./new_init.html">Initialisation with `new`</a></li>
<li><a href="./defaults.html">Defaults</a></li>
<li><a href="./select_single.html">Row selection - single row select</a></li>
<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
<li><a href="./select_os.html">Row selection - operating system style</a></li>
<li class="active"><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multi_instance.html">Multiple toolbars</a></li>
<li><a href="./collection.html">Button collections</a></li>
<li><a href="./plug-in.html">Plug-in button types</a></li>
<li><a href="./button_text.html">Custom button text</a></li>
<li><a href="./alter_buttons.html">Button arrangement</a></li>
<li><a href="./ajax.html">Ajax loaded data</a></li>
<li><a href="./pdf_message.html">PDF message</a></li>
<li><a href="./bootstrap.html">Bootstrap styling</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-2015<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
<!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>TableTools example - Setting the SWF path</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.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.tableTools.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: 'T<"clear">lfrtip',
tableTools: {
"sSwfPath": "../swf/copy_csv_xls_pdf.swf"
}
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>TableTools example <span>Setting the SWF path</span></h1>
<div class="info">
<p>TableTools uses a Flash SWF file to provide the ability to copy text to the system clipboard and save files locally. TableTools must be able to load the SWF
file in order to provide these facilities. If you aren't using the same directory structure as the TableTools package, you will need to set the
<code>sSwfPath</code> TableTools parameter, as shown in this example.</p>
<p>Note that TableTools ships with two different SWF files - the only difference between them is that one of them provides the ability to save PDF files while the
other doesn't. The trade off is that the PDF capable file is significantly larger in size (56K v 2K).</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$433,060</td>
</tr>
<tr>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008/11/28</td>
<td>$162,700</td>
</tr>
<tr>
<td>Brielle Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>2012/12/02</td>
<td>$372,000</td>
</tr>
<tr>
<td>Herrod Chandler</td>
<td>Sales Assistant</td>
<td>San Francisco</td>
<td>59</td>
<td>2012/08/06</td>
<td>$137,500</td>
</tr>
<tr>
<td>Rhona Davidson</td>
<td>Integration Specialist</td>
<td>Tokyo</td>
<td>55</td>
<td>2010/10/14</td>
<td>$327,900</td>
</tr>
<tr>
<td>Colleen Hurst</td>
<td>Javascript Developer</td>
<td>San Francisco</td>
<td>39</td>
<td>2009/09/15</td>
<td>$205,500</td>
</tr>
<tr>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>2008/12/13</td>
<td>$103,600</td>
</tr>
<tr>
<td>Jena Gaines</td>
<td>Office Manager</td>
<td>London</td>
<td>30</td>
<td>2008/12/19</td>
<td>$90,560</td>
</tr>
<tr>
<td>Quinn Flynn</td>
<td>Support Lead</td>
<td>Edinburgh</td>
<td>22</td>
<td>2013/03/03</td>
<td>$342,000</td>
</tr>
<tr>
<td>Charde Marshall</td>
<td>Regional Director</td>
<td>San Francisco</td>
<td>36</td>
<td>2008/10/16</td>
<td>$470,600</td>
</tr>
<tr>
<td>Haley Kennedy</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>43</td>
<td>2012/12/18</td>
<td>$313,500</td>
</tr>
<tr>
<td>Tatyana Fitzpatrick</td>
<td>Regional Director</td>
<td>London</td>
<td>19</td>
<td>2010/03/17</td>
<td>$385,750</td>
</tr>
<tr>
<td>Michael Silva</td>
<td>Marketing Designer</td>
<td>London</td>
<td>66</td>
<td>2012/11/27</td>
<td>$198,500</td>
</tr>
<tr>
<td>Paul Byrd</td>
<td>Chief Financial Officer (CFO)</td>
<td>New York</td>
<td>64</td>
<td>2010/06/09</td>
<td>$725,000</td>
</tr>
<tr>
<td>Gloria Little</td>
<td>Systems Administrator</td>
<td>New York</td>
<td>59</td>
<td>2009/04/10</td>
<td>$237,500</td>
</tr>
<tr>
<td>Bradley Greer</td>
<td>Software Engineer</td>
<td>London</td>
<td>41</td>
<td>2012/10/13</td>
<td>$132,000</td>
</tr>
<tr>
<td>Dai Rios</td>
<td>Personnel Lead</td>
<td>Edinburgh</td>
<td>35</td>
<td>2012/09/26</td>
<td>$217,500</td>
</tr>
<tr>
<td>Jenette Caldwell</td>
<td>Development Lead</td>
<td>New York</td>
<td>30</td>
<td>2011/09/03</td>
<td>$345,000</td>
</tr>
<tr>
<td>Yuri Berry</td>
<td>Chief Marketing Officer (CMO)</td>
<td>New York</td>
<td>40</td>
<td>2009/06/25</td>
<td>$675,000</td>
</tr>
<tr>
<td>Caesar Vance</td>
<td>Pre-Sales Support</td>
<td>New York</td>
<td>21</td>
<td>2011/12/12</td>
<td>$106,450</td>
</tr>
<tr>
<td>Doris Wilder</td>
<td>Sales Assistant</td>
<td>Sidney</td>
<td>23</td>
<td>2010/09/20</td>
<td>$85,600</td>
</tr>
<tr>
<td>Angelica Ramos</td>
<td>Chief Executive Officer (CEO)</td>
<td>London</td>
<td>47</td>
<td>2009/10/09</td>
<td>$1,200,000</td>
</tr>
<tr>
<td>Gavin Joyce</td>
<td>Developer</td>
<td>Edinburgh</td>
<td>42</td>
<td>2010/12/22</td>
<td>$92,575</td>
</tr>
<tr>
<td>Jennifer Chang</td>
<td>Regional Director</td>
<td>Singapore</td>
<td>28</td>
<td>2010/11/14</td>
<td>$357,650</td>
</tr>
<tr>
<td>Brenden Wagner</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>28</td>
<td>2011/06/07</td>
<td>$206,850</td>
</tr>
<tr>
<td>Fiona Green</td>
<td>Chief Operating Officer (COO)</td>
<td>San Francisco</td>
<td>48</td>
<td>2010/03/11</td>
<td>$850,000</td>
</tr>
<tr>
<td>Shou Itou</td>
<td>Regional Marketing</td>
<td>Tokyo</td>
<td>20</td>
<td>2011/08/14</td>
<td>$163,000</td>
</tr>
<tr>
<td>Michelle House</td>
<td>Integration Specialist</td>
<td>Sidney</td>
<td>37</td>
<td>2011/06/02</td>
<td>$95,400</td>
</tr>
<tr>
<td>Suki Burks</td>
<td>Developer</td>
<td>London</td>
<td>53</td>
<td>2009/10/22</td>
<td>$114,500</td>
</tr>
<tr>
<td>Prescott Bartlett</td>
<td>Technical Author</td>
<td>London</td>
<td>27</td>
<td>2011/05/07</td>
<td>$145,000</td>
</tr>
<tr>
<td>Gavin Cortez</td>
<td>Team Leader</td>
<td>San Francisco</td>
<td>22</td>
<td>2008/10/26</td>
<td>$235,500</td>
</tr>
<tr>
<td>Martena Mccray</td>
<td>Post-Sales support</td>
<td>Edinburgh</td>
<td>46</td>
<td>2011/03/09</td>
<td>$324,050</td>
</tr>
<tr>
<td>Unity Butler</td>
<td>Marketing Designer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/12/09</td>
<td>$85,675</td>
</tr>
<tr>
<td>Howard Hatfield</td>
<td>Office Manager</td>
<td>San Francisco</td>
<td>51</td>
<td>2008/12/16</td>
<td>$164,500</td>
</tr>
<tr>
<td>Hope Fuentes</td>
<td>Secretary</td>
<td>San Francisco</td>
<td>41</td>
<td>2010/02/12</td>
<td>$109,850</td>
</tr>
<tr>
<td>Vivian Harrell</td>
<td>Financial Controller</td>
<td>San Francisco</td>
<td>62</td>
<td>2009/02/14</td>
<td>$452,500</td>
</tr>
<tr>
<td>Timothy Mooney</td>
<td>Office Manager</td>
<td>London</td>
<td>37</td>
<td>2008/12/11</td>
<td>$136,200</td>
</tr>
<tr>
<td>Jackson Bradshaw</td>
<td>Director</td>
<td>New York</td>
<td>65</td>
<td>2008/09/26</td>
<td>$645,750</td>
</tr>
<tr>
<td>Olivia Liang</td>
<td>Support Engineer</td>
<td>Singapore</td>
<td>64</td>
<td>2011/02/03</td>
<td>$234,500</td>
</tr>
<tr>
<td>Bruno Nash</td>
<td>Software Engineer</td>
<td>London</td>
<td>38</td>
<td>2011/05/03</td>
<td>$163,500</td>
</tr>
<tr>
<td>Sakura Yamamoto</td>
<td>Support Engineer</td>
<td>Tokyo</td>
<td>37</td>
<td>2009/08/19</td>
<td>$139,575</td>
</tr>
<tr>
<td>Thor Walton</td>
<td>Developer</td>
<td>New York</td>
<td>61</td>
<td>2013/08/11</td>
<td>$98,540</td>
</tr>
<tr>
<td>Finn Camacho</td>
<td>Support Engineer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/07/07</td>
<td>$87,500</td>
</tr>
<tr>
<td>Serge Baldwin</td>
<td>Data Coordinator</td>
<td>Singapore</td>
<td>64</td>
<td>2012/04/09</td>
<td>$138,575</td>
</tr>
<tr>
<td>Zenaida Frank</td>
<td>Software Engineer</td>
<td>New York</td>
<td>63</td>
<td>2010/01/04</td>
<td>$125,250</td>
</tr>
<tr>
<td>Zorita Serrano</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>56</td>
<td>2012/06/01</td>
<td>$115,000</td>
</tr>
<tr>
<td>Jennifer Acosta</td>
<td>Junior Javascript Developer</td>
<td>Edinburgh</td>
<td>43</td>
<td>2013/02/01</td>
<td>$75,650</td>
</tr>
<tr>
<td>Cara Stevens</td>
<td>Sales Assistant</td>
<td>New York</td>
<td>46</td>
<td>2011/12/06</td>
<td>$145,600</td>
</tr>
<tr>
<td>Hermione Butler</td>
<td>Regional Director</td>
<td>London</td>
<td>47</td>
<td>2011/03/21</td>
<td>$356,250</td>
</tr>
<tr>
<td>Lael Greer</td>
<td>Systems Administrator</td>
<td>London</td>
<td>21</td>
<td>2009/02/27</td>
<td>$103,500</td>
</tr>
<tr>
<td>Jonas Alexander</td>
<td>Developer</td>
<td>San Francisco</td>
<td>30</td>
<td>2010/07/14</td>
<td>$86,500</td>
</tr>
<tr>
<td>Shad Decker</td>
<td>Regional Director</td>
<td>Edinburgh</td>
<td>51</td>
<td>2008/11/13</td>
<td>$183,000</td>
</tr>
<tr>
<td>Michael Bruce</td>
<td>Javascript Developer</td>
<td>Singapore</td>
<td>29</td>
<td>2011/06/27</td>
<td>$183,000</td>
</tr>
<tr>
<td>Donna Snider</td>
<td>Customer Support</td>
<td>New York</td>
<td>27</td>
<td>2011/01/25</td>
<td>$112,000</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 language-js">$(document).ready(function() {
$('#example').DataTable( {
dom: 'T&lt;&quot;clear&quot;&gt;lfrtip',
tableTools: {
&quot;sSwfPath&quot;: &quot;../swf/copy_csv_xls_pdf.swf&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.tableTools.js">../js/dataTables.tableTools.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 language-css"></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.tableTools.css">../css/dataTables.tableTools.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 class="active"><a href="./swf_path.html">Setting the SWF path</a></li>
<li><a href="./new_init.html">Initialisation with `new`</a></li>
<li><a href="./defaults.html">Defaults</a></li>
<li><a href="./select_single.html">Row selection - single row select</a></li>
<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
<li><a href="./select_os.html">Row selection - operating system style</a></li>
<li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multi_instance.html">Multiple toolbars</a></li>
<li><a href="./collection.html">Button collections</a></li>
<li><a href="./plug-in.html">Plug-in button types</a></li>
<li><a href="./button_text.html">Custom button text</a></li>
<li><a href="./alter_buttons.html">Button arrangement</a></li>
<li><a href="./ajax.html">Ajax loaded data</a></li>
<li><a href="./pdf_message.html">PDF message</a></li>
<li><a href="./bootstrap.html">Bootstrap styling</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-2015<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
......@@ -41,6 +41,9 @@ $(function() {
} else if ("job_del" == type) {
typeName = "删除";
url = base_url + "/job/remove";
} else if ("job_trigger" == type) {
typeName = "执行一次";
url = base_url + "/job/trigger";
} else {
return;
}
......@@ -70,9 +73,16 @@ $(function() {
});
});
// jquery.validate 自定义校验 “英文字母开头,只含有英文字母、数字和下划线”
jQuery.validator.addMethod("myValid01", function(value, element) {
var length = value.length;
var valid = /^[a-zA-Z][a-zA-Z0-9_]*$/;
return this.optional(element) || valid.test(value);
}, "只支持英文字母开头,只含有英文字母、数字和下划线");
// 新增
$(".add").click(function(){
$('#addModal').modal('show');
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
});
var addModalValidate = $("#addModal .form").validate({
errorElement : 'span',
......@@ -82,17 +92,22 @@ $(function() {
triggerKeyName : {
required : true ,
minlength: 4,
maxlength: 100
maxlength: 100,
myValid01:true
},
cronExpression : {
required : true ,
maxlength: 100
},
jobClassName : {
job_desc : {
required : true ,
maxlength: 100
},
jobDesc : {
maxlength: 200
},
job_url : {
required : true ,
maxlength: 200
},
handleName : {
required : true ,
maxlength: 200
}
......@@ -100,20 +115,24 @@ $(function() {
messages : {
triggerKeyName : {
required :"请输入“任务Key”." ,
minlength:"“任务Key”不应低于4位",
maxlength:"“任务Key”不应超过100位"
minlength:"“任务Key”长度不应低于4位",
maxlength:"“任务Key”长度不应超过100位"
},
cronExpression : {
required :"请输入“任务Corn”." ,
maxlength:"“任务Corn”不应超过100位"
},
jobClassName : {
required :"请输入“任务Impl”." ,
maxlength:"“任务Impl”不应超过100位"
maxlength:"“任务Corn”长度不应超过100位"
},
jobDesc : {
job_desc : {
required :"请输入“任务描述”." ,
maxlength:"“任务描述”不应超过200位"
maxlength:"“任务描述”长度不应超过200位"
},
job_url : {
required :"请输入“任务URL”." ,
maxlength:"“任务URL”长度不应超过200位"
},
handleName : {
required : "请输入“任务handler”." ,
maxlength: "“任务handler”长度不应超过200位"
}
},
highlight : function(element) {
......@@ -127,32 +146,77 @@ $(function() {
element.parent('div').append(error);
},
submitHandler : function(form) {
$.post(base_url + "/job/add", $("#addModal .form").serialize(), function(data, status) {
if (data.code == "200") {
ComAlert.show(1, "新增调度任务成功", function(){
window.location.reload();
});
} else {
if (data.msg) {
ComAlert.show(2, data.msg);
} else {
ComAlert.show(2, "新增失败");
var triggerKeyName = $('#addModal input[name="triggerKeyName"]').val();
var cronExpression = $('#addModal input[name="cronExpression"]').val();
var job_desc = $('#addModal input[name="job_desc"]').val();
var job_url = $('#addModal input[name="job_url"]').val();
var handleName = $('#addModal input[name="handleName"]').val();
var paramStr = 'triggerKeyName=' + triggerKeyName +
'&cronExpression=' + cronExpression +
'&job_desc=' + job_desc +
'&job_url=' + job_url +
'&handleName=' + handleName;
var ifFin = true;
$('#addModal .newParam').each(function(){
ifFin = false;
var key = $(this).find('input[name="key"]').val();
var value = $(this).find('input[name="value"]').val();
if (!key) {
ComAlert.show(2, "新增参数key不可为空");
return;
} else {
if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(key)){
ComAlert.show(2, "新增参数key不合法, 只支持英文字母开头,只含有英文字母、数字和下划线");
return;
}
}
});
}
paramStr += "&" + key + "=" + value;
ifFin = true;
});
if(ifFin){
$.post(base_url + "/job/add", paramStr, function(data, status) {
if (data.code == "200") {
ComAlert.show(1, "新增调度任务成功", function(){
window.location.reload();
});
} else {
if (data.msg) {
ComAlert.show(2, data.msg);
} else {
ComAlert.show(2, "新增失败");
}
}
});
}
}
});
$("#addModal").on('hide.bs.modal', function () {
$("#addModal .form")[0].reset()
});
// 新增-添加参数
$("#addModal .addParam").on('click', function () {
var html = '<div class="form-group newParam">'+
'<label for="lastname" class="col-sm-2 control-label">参数&nbsp;<button class="btn btn-danger btn-xs removeParam" type="button">移除</button></label>'+
'<div class="col-sm-4"><input type="text" class="form-control" name="key" placeholder="请输入参数key[将会强转为String]" maxlength="200" /></div>'+
'<div class="col-sm-6"><input type="text" class="form-control" name="value" placeholder="请输入参数value[将会强转为String]" maxlength="200" /></div>'+
'</div>';
$(this).parents('.form-group').parent().append(html);
$("#addModal .removeParam").on('click', function () {
$(this).parents('.form-group').remove();
});
});
// 更新
$(".update").click(function(){
$("#updateModal .form input[name='triggerKeyName']").val($(this).parent('p').attr("name"));
$("#updateModal .form input[name='cronExpression']").val($(this).parent('p').attr("cronExpression"));
$("#updateModal .form input[name='jobClassName']").val($(this).parent('p').attr("jobClassName"));
$("#updateModal .form input[name='jobDesc']").val($(this).parent('p').attr("jobDesc"));
$('#updateModal').modal('show');
$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
});
var updateModalValidate = $("#updateModal .form").validate({
errorElement : 'span',
......@@ -167,14 +231,6 @@ $(function() {
cronExpression : {
required : true ,
maxlength: 100
},
jobClassName : {
required : true ,
maxlength: 100
},
jobDesc : {
required : true ,
maxlength: 200
}
},
messages : {
......@@ -186,14 +242,6 @@ $(function() {
cronExpression : {
required :"请输入“任务Corn”." ,
maxlength:"“任务Corn”不应超过100位"
},
jobClassName : {
required :"请输入“任务Impl”." ,
maxlength:"“任务Impl”不应超过100位"
},
jobDesc : {
required :"请输入“任务描述”." ,
maxlength:"“任务描述”不应超过200位"
}
},
highlight : function(element) {
......
package quartz;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.quartz.SchedulerException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.xxl.quartz.DynamicSchedulerUtil;
import com.xxl.service.job.TestDynamicJob;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath*:applicationcontext-*.xml")
public class JunitTest {
@Test
public void getJobKeys() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
List<Map<String, Object>> list = DynamicSchedulerUtil.getJobList();
System.out.println(list);
TimeUnit.SECONDS.sleep(30);
}
@Test
public void addJob() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
Map<String, Object> jobData = new HashMap<String, Object>();
jobData.put(DynamicSchedulerUtil.job_desc, "测试调度03");
boolean ret = DynamicSchedulerUtil.addJob("demo-job04", "0/4 * * * * ?", TestDynamicJob.class, jobData);
System.out.println(ret);
TimeUnit.SECONDS.sleep(3);
}
@Test
public void removeJob() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
boolean ret = DynamicSchedulerUtil.removeJob("demo-job02");
System.out.println(ret);
TimeUnit.SECONDS.sleep(30);
}
@Test
public void rescheduleJob() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
boolean ret = DynamicSchedulerUtil.rescheduleJob("demo-job02", "0/3 * * * * ?");
System.out.println(ret);
TimeUnit.SECONDS.sleep(30);
}
@Test
public void pauseJob() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
boolean ret = DynamicSchedulerUtil.pauseJob("demo-job02");
System.out.println(ret);
TimeUnit.SECONDS.sleep(30);
}
@Test
public void resumeTrigger() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
boolean ret = DynamicSchedulerUtil.resumeJob("demo-job02");
System.out.println(ret);
TimeUnit.SECONDS.sleep(30);
}
}
package timer.test;
import java.util.Date;
import java.util.Timer;
import org.apache.commons.lang.time.FastDateFormat;
public class TimerTest {
static class DemoTimeTask extends java.util.TimerTask {
public void run() {
System.out.println("run:" + FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss").format(new Date()));
}
}
// ??? 某一个时间段内,重复执行
// runTime:第一次执行时间
// delay: 延迟执行的毫秒数,即在delay毫秒之后第一次执行
// period:重复执行的时间间隔
public static Timer mainTimer;
public static void main(String[] args) {
// 调度器
mainTimer = new Timer();
// Demo任务
DemoTimeTask timeTask = new DemoTimeTask();
System.out.println("now:" + FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss").format(new Date()));
// 1、在特定时间执行任务,只执行一次
//Date runTime = DateUtils.addSeconds(new Date(), 1);
//mainTimer.schedule(timeTask, runTime); // runTime
// 2、在特定时间之后执行任务,只执行一次
//long delay = 1000;
//mainTimer.schedule(timeTask, delay); // delay/ms
// 3、指定第一次执行的时间,然后按照间隔时间,重复执行
//Date firstTime = DateUtils.addSeconds(new Date(), 1);
//long period = 1000;
//mainTimer.schedule(timeTask, firstTime, period); // "period/ms" after "firstTime"
// 4、在特定延迟之后第一次执行,然后按照间隔时间,重复执行
//long delay = 1000;
//long period = 1000;
//mainTimer.schedule(timeTask, delay, period); // "period/ms" after "delay/ms"
// 5、第一次执行之后,特定频率执行,与3同
//Date firstTime = DateUtils.addSeconds(new Date(), 1);
//long period = 1000;
//mainTimer.scheduleAtFixedRate(timeTask, firstTime, period);
// 6、在delay毫秒之后第一次执行,后按照特定频率执行
long delay = 1000;
long period = 1000;
mainTimer.scheduleAtFixedRate(timeTask, delay, period);
/**
* <1>schedule()方法更注重保持间隔时间的稳定:保障每隔period时间可调用一次
* <2>scheduleAtFixedRate()方法更注重保持执行频率的稳定:保障多次调用的频率趋近于period时间,如果任务执行时间大于period,会在任务执行之后马上执行下一次任务
*/
// Timer注销
mainTimer.cancel();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>xxl-job-client-demo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry excluding="**/*.min.js|**/node_modules/*|**/bower_components/*" kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
eclipse.preferences.version=1
encoding//src/main/java=UTF8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="xxl-job-client-demo">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="xxl-job-client-1.1.2-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/xxl-job-client/xxl-job-client">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="xxl-job-client-demo"/>
<property name="java-output-path" value="/xxl-job-client-demo/target/classes"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
disabled=06target
eclipse.preferences.version=1
......@@ -2,14 +2,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.dianping</groupId>
<artifactId>dianping-job</artifactId>
<version>0.0.1-SNAPSHOT</version>
<groupId>com.xxl</groupId>
<artifactId>xxl-job</artifactId>
<version>1.1.1-SNAPSHOT</version>
</parent>
<artifactId>dianping-job-client-demo</artifactId>
<artifactId>xxl-job-client-demo</artifactId>
<version>1.1.2-SNAPSHOT</version>
<packaging>war</packaging>
<name>dianping-job-client-demo</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.2.14.RELEASE</spring.version>
......@@ -52,11 +51,11 @@
<version>1.7.5</version>
</dependency>
<!-- dianping-job-client -->
<!-- xxl-job-client -->
<dependency>
<groupId>com.dianping</groupId>
<artifactId>dianping-job-client</artifactId>
<version>1.0.1-SNAPSHOT</version>
<groupId>com.xxl</groupId>
<artifactId>xxl-job-client</artifactId>
<version>1.1.2-SNAPSHOT</version>
</dependency>
</dependencies>
......
package com.dianping.job.service.handler;
package com.xxl.job.service.handler;
import java.util.Map;
import java.util.Random;
......@@ -8,8 +8,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.dianping.job.client.handler.HandlerRepository;
import com.dianping.job.client.handler.IJobHandler;
import com.xxl.job.client.handler.HandlerRepository;
import com.xxl.job.client.handler.IJobHandler;
/**
* demo job handler
......
......@@ -9,7 +9,6 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<context:annotation-config />
<context:component-scan base-package="com.dianping.job.service" />
<context:component-scan base-package="com.xxl.job.service" />
</beans>
\ No newline at end of file
......@@ -2,9 +2,9 @@ log4j.rootLogger=info,console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d - dianping-job-client-demo - %p [%c] - <%m>%n
log4j.appender.console.layout.ConversionPattern=%d - xxl-job-client-demo - %p [%c] - <%m>%n
log4j.appender.logFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logFile.File=${catalina.base}/logs/dianping-job-client-demo.log
log4j.appender.logFile.File=${catalina.base}/logs/xxl-job-client-demo.log
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
log4j.appender.logFile.layout.ConversionPattern=%d - dianping-job-client-demo - %p [%c] - <%m>%n
log4j.appender.logFile.layout.ConversionPattern=%d - xxl-job-client-demo - %p [%c] - <%m>%n
......@@ -3,7 +3,11 @@
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>xxl-job-client-demo</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationcontext-*.xml</param-value>
......@@ -16,18 +20,17 @@
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Dianping Job Servlet -->
<!-- Xxl Job Servlet -->
<servlet>
<servlet-name>DianpingJobServlet</servlet-name>
<servlet-class>com.dianping.job.client.netcom.http.DianpingJobServlet</servlet-class>
<servlet-name>XxlJobServlet</servlet-name>
<servlet-class>com.xxl.job.client.netcom.http.XxlJobServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DianpingJobServlet</servlet-name>
<url-pattern>/dianpingJobServlet</url-pattern>
<servlet-name>XxlJobServlet</servlet-name>
<url-pattern>/xxlJobServlet</url-pattern>
</servlet-mapping>
<display-name>clock-job-web</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>xxl-job-client</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding//src/main/java=UTF8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="xxl-job-client">
<wb-resource deploy-path="/" source-path="/src/main/java"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.6"/>
<installed facet="jst.utility" version="1.0"/>
</faceted-project>
disabled=06target
eclipse.preferences.version=1
......@@ -2,14 +2,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.dianping</groupId>
<artifactId>dianping-job</artifactId>
<version>0.0.1-SNAPSHOT</version>
<groupId>com.xxl</groupId>
<artifactId>xxl-job</artifactId>
<version>1.1.1-SNAPSHOT</version>
</parent>
<artifactId>dianping-job-client</artifactId>
<version>1.0.1-SNAPSHOT</version>
<name>dianping-job-client</name>
<url>http://maven.apache.org</url>
<artifactId>xxl-job-client</artifactId>
<version>1.1.2-SNAPSHOT</version>
<dependencies>
......
package com.dianping.job.client.handler;
package com.xxl.job.client.handler;
import java.io.PrintWriter;
import java.io.StringWriter;
......@@ -10,8 +10,9 @@ import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.dianping.job.client.handler.IJobHandler.JobHandleStatus;
import com.dianping.job.client.handler.IJobHandler.JobTriggerStatus;
import com.xxl.job.client.handler.IJobHandler.JobHandleStatus;
import com.xxl.job.client.handler.IJobHandler.JobTriggerStatus;
/**
* handler repository
......@@ -38,7 +39,7 @@ public class HandlerRepository {
HandlerThread handlerThread = new HandlerThread(handleName);
handlerThread.start();
handlerTreadMap.put(handleName, handlerThread);
logger.info(">>>>>>>>>>> dianping-job regist handler success, handleName:{}, handler:{}, handlerDateQueue:{}, handlerThread:{}",
logger.info(">>>>>>>>>>> xxl-job regist handler success, handleName:{}, handler:{}, handlerDateQueue:{}, handlerThread:{}",
new Object[]{handleName, handler, handlerDateQueue, handlerThread});
}
......@@ -71,7 +72,7 @@ public class HandlerRepository {
jobHandleDetail = out.toString();
}
String _triggerUuid = handlerDate.get(triggerUuid);
logger.info("<<<<<<<<<<< dianping-job thread handle, _triggerUuid:{}, _handleName:{}, jobHandleStatus:{}, jobHandleDetail:{}, thread:{}",
logger.info("<<<<<<<<<<< xxl-job thread handle, _triggerUuid:{}, _handleName:{}, jobHandleStatus:{}, jobHandleDetail:{}, thread:{}",
new Object[]{_triggerUuid, _handleName, jobHandleStatus, jobHandleDetail, this});
} else {
try {
......@@ -98,7 +99,7 @@ public class HandlerRepository {
if (handlerDateQueue == null) {
handlerDateQueue = new LinkedBlockingQueue<Map<String, String>>();
handlerDataQueueMap.put(handleName, handlerDateQueue);
logger.info(">>>>>>>>>>> dianping-job handler lazy fresh handlerDateQueue, handleName:{}, handler:{}, handlerDateQueue:{}",
logger.info(">>>>>>>>>>> xxl-job handler lazy fresh handlerDateQueue, handleName:{}, handler:{}, handlerDateQueue:{}",
new Object[]{handleName, handler, handlerDateQueue});
}
handlerDateQueue.offer(_param);
......@@ -109,7 +110,7 @@ public class HandlerRepository {
HandlerThread handlerThread = new HandlerThread(handleName);
handlerThread.start();
handlerTreadMap.put(handleName, handlerThread);
logger.info(">>>>>>>>>>> dianping-job handler lazy fresh thread, handleName:{}, handler:{}, handlerThread:{}",
logger.info(">>>>>>>>>>> xxl-job handler lazy fresh thread, handleName:{}, handler:{}, handlerThread:{}",
new Object[]{handleName, handler, handlerThread});
}
_triggerStatus = JobTriggerStatus.SUCCESS;
......@@ -122,7 +123,7 @@ public class HandlerRepository {
e.printStackTrace(new PrintWriter(out));
_triggerDetailLog = out.toString();
}
logger.info(">>>>>>>>>>> dianping-job pushHandleQueue, triggerUuid:{}, handleName, _triggerStatus:{}, _triggerDetailLog",
logger.info(">>>>>>>>>>> xxl-job pushHandleQueue, triggerUuid:{}, handleName, _triggerStatus:{}, _triggerDetailLog",
new Object[]{triggerUuid, handleName, _triggerStatus, _triggerDetailLog});
String responseBody = _triggerStatus.name();
......
package com.dianping.job.client.netcom.http;
package com.xxl.job.client.netcom.http;
import java.io.IOException;
......@@ -10,19 +10,20 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dianping.job.client.handler.HandlerRepository;
import com.xxl.job.client.handler.HandlerRepository;
/**
* remote job client on http
* @author xuxueli 2015-12-19 18:36:47
*/
public class DianpingJobServlet extends HttpServlet {
public class XxlJobServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* Default constructor.
*/
public DianpingJobServlet() {
public XxlJobServlet() {
// TODO Auto-generated constructor stub
}
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>xxl-job-simple</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry excluding="**/*.min.js|**/node_modules/*|**/bower_components/*" kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
eclipse.preferences.version=1
encoding//src/main/java=UTF8
encoding//src/test/java=UTF8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="xxl-job-simple">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="xxl-job-simple"/>
<property name="java-output-path" value="/xxl-job-simple/target/classes"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
disabled=06target
eclipse.preferences.version=1
......@@ -2,16 +2,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.dianping</groupId>
<artifactId>dianping-job</artifactId>
<version>0.0.1-SNAPSHOT</version>
<groupId>com.xxl</groupId>
<artifactId>xxl-job</artifactId>
<version>1.1.1-SNAPSHOT</version>
</parent>
<artifactId>dianping-job-web</artifactId>
<version>1.0.1-SNAPSHOT</version>
<artifactId>xxl-job-simple</artifactId>
<version>1.1.2-SNAPSHOT</version>
<packaging>war</packaging>
<name>dianping-job-web</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.2.14.RELEASE</spring.version>
</properties>
......@@ -131,20 +129,6 @@
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
<!-- httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<!-- dianping-job-client -->
<dependency>
<groupId>com.dianping</groupId>
<artifactId>dianping-job-client</artifactId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
......
......@@ -17,11 +17,10 @@ import com.xxl.quartz.DynamicSchedulerUtil;
import com.xxl.quartz.ReturnT;
@Controller
@RequestMapping("/job")
public class IndexController {
@RequestMapping("/index")
@RequestMapping("")
public String index(Model model) {
List<Map<String, Object>> jobList = DynamicSchedulerUtil.getJobList();
model.addAttribute("jobList", jobList);
......
......@@ -10,7 +10,7 @@
http://www.springframework.org/schema/util/spring-util.xsd">
<context:annotation-config />
<context:component-scan base-package="com.dianping.job.service" />
<context:component-scan base-package="com.xxl.service.impl, com.xxl.dao.impl" />
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/WEB-INF/template/" />
......@@ -19,6 +19,11 @@
<property name="location" value="classpath:freemarker.properties" />
</bean>
</property>
<property name="freemarkerVariables">
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="classpath:freemarker.variables.properties" />
</bean>
</property>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
......
......@@ -15,6 +15,7 @@
<context:annotation-config />
<context:component-scan base-package="com.xxl.service.impl, com.xxl.dao.impl" />
<!-- c3p0:Main数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${c3p0.driverClass}" />
<property name="jdbcUrl" value="${c3p0.url}" />
......@@ -34,7 +35,7 @@
<property name="mapperLocations" value="classpath*:com/xxl/core/model/mapper/*.xml"/>
</bean>
<!-- scope must be "prototype" when junit -->
<!-- Template在Junit测试的时候,必须使用scope="prototype",原因未知 -->
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
<constructor-arg index="0" ref="sqlSessionFactory" />
</bean>
......
......@@ -9,16 +9,37 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!-- Job trigger -->
<bean id="job02Trigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" >
<bean class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="com.xxl.service.job.JobDetailDemo"/>
<property name="jobDataAsMap">
<map>
<!-- <entry key="xxService" value-ref="xxService" /> -->
</map>
</property>
<property name="durability" value="true" />
</bean>
</property>
<property name="cronExpression" value="0/3 * * * * ? *" />
</bean>
<!-- Job信息会被上报并持久化到mysql中,多个集群节点中竞争Job锁,只会有一台执行 -->
<bean id="quartzScheduler" lazy-init="false" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="autoStartup" value="true" />
<property name="applicationContextSchedulerContextKey" value="applicationContextKey" />
<property name="configLocation" value="classpath:quartz.properties"/>
<property name="triggers">
<list>
<!-- <ref bean="job02Trigger" /> -->
</list>
</property>
</bean>
<!-- 协同-调度器 -->
<bean id="dynamicSchedulerUtil" class="com.dianping.job.core.util.DynamicSchedulerUtil">
<!-- (轻易不要变更“调度器名称”, 任务创建时会绑定该“调度器名称”) -->
<!-- 调度器 -->
<bean id="dynamicSchedulerUtil" class="com.xxl.quartz.DynamicSchedulerUtil">
<property name="scheduler" ref="quartzScheduler"/>
</bean>
......
......@@ -20,11 +20,11 @@
<property name="cronExpression" value="0/10 * * * * ? *" />
</bean>
<!-- 进程-调度器 -->
<bean name="jvmQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<!-- Job被加载到内存中,每个集群节点相互独立,都会执行该任务 -->
<bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<!-- <ref bean="beatTrigger" /> -->
<ref bean="beatTrigger" />
</list>
</property>
</bean>
......
......@@ -12,12 +12,15 @@
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- 事务管理器(声明式事务) -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 启动事务注解(方式1:注解方式) -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<!-- 事务通知(方式2:XML事务管理) -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="detail*" propagation="SUPPORTS" />
......@@ -30,8 +33,11 @@
</tx:attributes>
</tx:advice>
<!-- AOP配置 -->
<aop:config>
<!-- 定义一个切入点 -->
<aop:pointcut id="txoperation" expression="execution(* com.xxl.service.imp.*.*(..))" />
<!-- 切入点事务通知 -->
<aop:advisor pointcut-ref="txoperation" advice-ref="txAdvice" />
</aop:config>
......
log4j.rootLogger=info,console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d - xxl-job-demo - %p [%c] - <%m>%n
log4j.appender.logFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logFile.File=${catalina.base}/logs/xxl-job-demo.log
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
log4j.appender.logFile.layout.ConversionPattern=%d - xxl-job-demo - %p [%c] - <%m>%n
......@@ -18,7 +18,6 @@ org.quartz.jobStore.misfireThreshold: 60000
#org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
# for cluster
org.quartz.jobStore.tablePrefix = WED_qrtz_
org.quartz.scheduler.instanceId: AUTO
org.quartz.jobStore.class: org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.isClustered: true
......
......@@ -18,35 +18,34 @@
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<description>Spring-web MVC配置</description>
<mvc:annotation-driven />
<context:component-scan base-package="com.dianping.job.controller" />
<context:component-scan base-package="com.xxl.controller" />
<mvc:resources mapping="/favicon.ico" location="/favicon.ico" />
<mvc:resources mapping="/static/**" location="/static/" />
<mvc:resources mapping="/**/*.html" location="/" />
<mvc:resources mapping="/static/**" location="/static/" /> <!-- 不拦截static目录下 -->
<mvc:resources mapping="/**/*.html" location="/" /> <!-- 不拦截.html后缀 -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" />
<property name="prefix" value="" />
<property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView" /> <!-- 解析视图模板类 -->
<property name="prefix" value="" /> <!-- 模板前后缀,指定html页面为模板 -->
<property name="suffix" value=".ftl" />
<property name="contentType" value="text/html;charset=UTF-8" />
<property name="exposeSpringMacroHelpers" value="true" />
<property name="exposeRequestAttributes" value="true" />
<property name="exposeSessionAttributes" value="true" />
<property name="requestContextAttribute" value="request" />
<property name="contentType" value="text/html;charset=UTF-8" /> <!-- 模板输出内容编码 (此处应与defaultEncoding保持一致) -->
<property name="exposeSpringMacroHelpers" value="true" /> <!-- 访问Request/Session宏助手 -->
<property name="exposeRequestAttributes" value="true" /> <!-- 允许访问Request属性,默认为false -->
<property name="exposeSessionAttributes" value="true" /> <!-- 允许访问Session属性,默认为false -->
<property name="requestContextAttribute" value="request" /> <!-- 将HttpServletRequest的属性存放到request这个变量中 -->
<property name="cache" value="true" />
<property name="order" value="0" />
</bean>
<!--
// 自定义拦截器,支持SSO登陆拦截
<mvc:interceptors>
<!-- <mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="com.xxl.controller.interceptor.PermissionInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
<bean id="exceptionResolver" class="com.xxl.controller.resolver.WebExceptionResolver" />
-->
<bean id="exceptionResolver" class="com.xxl.controller.resolver.WebExceptionResolver" /> -->
</beans>
\ No newline at end of file
......@@ -37,6 +37,8 @@
<script src="${request.contextPath}/static/adminlte/plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="${request.contextPath}/static/adminlte/dist/js/app.min.js"></script>
<!-- SlimScroll 1.3.0 -->
<script src="${request.contextPath}/static/adminlte/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- scrollup -->
<script src="${request.contextPath}/static/plugins/scrollup/jquery.scrollUp.min.js"></script>
......@@ -45,15 +47,71 @@
<#macro commonHeader>
<header class="main-header">
<a href="${request.contextPath}/" class="logo">
<span class="logo-mini"><b>X</b>XL</span>
<span class="logo-lg"><b>任务调度</b>中心</span>
<!-- Logo -->
<a href="${request.contextPath}/" class="logo"> <!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>X</b>XL</span> <!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>调度</b>中心</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">切换导航</span></a>
<div class="navbar-custom-menu"></div>
<#--
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell-o"></i> <span class="label label-warning">5</span></a>
<ul class="dropdown-menu">
<li class="header">您有5条通知</li>
<li>
<ul class="menu">
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个不错的应用
</a></li>
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个很不错的应用
</a></li>
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个非常不错的应用
</a></li>
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个非常非常不错的应用
</a></li>
<li><a href="#"> <i class="fa fa-warning text-yellow"></i>
这是一个非常非常非常不错的应用
</a></li>
</ul>
</li>
<li class="footer"><a href="#">查看全部</a></li>
</ul>
</li>
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-user text-aqua"></i><span class="hidden-xs">${loginIdentity.userName}</span>
</a>
<ul class="dropdown-menu">
<li class="user-header">
<p>
${loginIdentity.realName} - 前端研发
<small>注册于 2012-11-20</small>
</p>
</li>
<li class="user-footer">
<div class="pull-left"><a href="#" class="btn btn-default btn-flat">资料</a></div>
<div class="pull-right"><a href="javascript:;" class="btn btn-default btn-flat" id="logoutBtn" >注销</a></div>
</li>
</ul></li>
<li><a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a></li>
</ul>
</div>
-->
</nav>
</header>
</#macro>
<#macro commonLeft>
......@@ -63,9 +121,22 @@
<section class="sidebar">
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header">常用模块</li>
<li class="nav-click" ><a href="${request.contextPath}//"><i class="fa fa-circle-o text-red"></i> <span>调度中心</span></a></li>
<li class="nav-click" ><a href="${request.contextPath}//"><i class="fa fa-circle-o text-red"></i> <span>调度管理</span></a></li>
<li class="nav-click" ><a href="${request.contextPath}/help"><i class="fa fa-circle-o text-yellow"></i><span>使用教程</span></a></li>
<#--
<li class="header">全部模块</li>
<li class="treeview nav-click">
<a href="#"><i class="fa fa-dashboard"></i> <span>调度中心</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<li class="nav-click" ><a href="${request.contextPath}/job/index"><i class="fa fa-circle-o"></i>调度管理</a></li>
<li class="nav-click" ><a href="${request.contextPath}/job/help"><i class="fa fa-circle-o"></i>使用教程</a></li>
</ul>
</li>
-->
</ul>
</section>
<!-- /.sidebar -->
......@@ -155,8 +226,8 @@
<b>Version</b> 1.0
</div>
<strong>Copyright &copy; 2015-2015 &nbsp;
<a href="https://github.com/xuxueli/xxl-job" target="_blank" >github</a>&nbsp;
<a href="http://www.cnblogs.com/xuxueli/p/5021979.html" target="_blank" >cnblog</a>.
<a href="https://github.com/xuxueli/" target="_blank" >github</a>&nbsp;
<a href="http://www.cnblogs.com/xuxueli/" target="_blank" >cnblog</a>.
</strong> All rights reserved.
</footer>
</#macro>
......
<!DOCTYPE html>
<html>
<head>
<title>调度中心</title>
<title>AdminLTE 2 | Dashboard</title>
<#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle />
</head>
......@@ -26,41 +26,18 @@
<!-- Main content -->
<section class="content">
<div class="callout callout-info">
<h4>简介:DIANPING_CLOCK</h4>
<p>基于quartz封装实现的的集群任务调度管理平台.</p>
<h4>简介:xxl-job</h4>
<p>调度管理平台:基于quartz封装实现的的集群任务调度管理平台.</p>
<p></p>
</div>
<div class="callout callout-default">
<div class="callout callout-info">
<h4>特点:</h4>
<p>1、简单:支持通过Web页面对任务进行CRUD操作,操作简单,一分钟上手.</p>
<p>2、动态:支持动态修改任务状态,动态暂停/恢复任务,即时生效.</p>
<p>3、集群:任务信息持久化到mysql中,支持Job服务器集群(高可用),一个任务只会在其中一台服务器上执行.</p>
</div>
<div class="callout callout-default">
<h4>分层模型:</h4>
<p>1、基础:基于quartz封装底层调度层,通过CORN自定义任务执行周期,最终执行自定义JobBean的execute方法,如需多个任务,需要开发多个JobBean实现.</p>
<p>2、分层:上述基础调度模型存在一定局限,调度层和任务层耦合,当新任务上线势必影响任务的正常调度,因此规划将调度系统分层为:调度层 + 任务层 + 通讯层.</p>
<p>
<div class="row">
<div class="col-xs-offset-1 col-xs-11">
<p>》调度模块:维护任务的调度信息,负责定时/周期性的发出调度请求.</p>
<p>》任务模块:具体的任务逻辑,负责接收调度模块的调度请求,执行任务逻辑.</p>
<p>》通讯模块:负责调度模块和任务模块之间的通讯.</p>
<p>(总而言之,一条完整任务由 “调度信息” 和 “任务信息” 组成.)</p>
</div>
</div>
</p>
</div>
<div class="callout callout-default">
<h4>调度属性解析 : 发出HTTP调度请求</h4>
<p>1、调度Key【必填】:调度信息的全局唯一标识.</p>
<p>2、调度Corn【必填】:调度执行的时间表达式.</p>
<p>3、调度描述【必填】:调度的简述.</p>
<p>4、调度URL【必填】:调度执行时发出HTTP请求的目标URL地址.</p>
<p>5、+args【选填】:调度执行时发出HTTP请求的附带的POST参数.</p>
</div>
</section>
<!-- /.content -->
</div>
......
......@@ -19,10 +19,10 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>调度中心<small>调度管理</small></h1>
<h1>使用教程<small>调度管理平台</small></h1>
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>调度中心</a></li>
<li class="active">调度管理</li>
<li class="active">使用教程</li>
</ol>
</section>
......@@ -32,17 +32,17 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">调度列表</h3>
<button class="btn btn-info btn-xs add" type="button">+新增任务</button>
<h3 class="box-title">任务列表</h3>
<button class="btn btn-primary btn-xs add" type="button">新增</button>
</div>
<div class="box-body">
<table id="job_list" class="table table-bordered table-striped">
<thead>
<tr>
<th>调度key</th>
<th>任务ID</th>
<th>cron</th>
<!--<th>类路径</th>-->
<th>参数</th>
<th>Job类路径</th>
<th>简介</th>
<th>状态</th>
<th>操作</th>
</tr>
......@@ -53,13 +53,11 @@
<tr>
<td>${item['TriggerKey'].name}</td>
<td>${item['Trigger'].cronExpression}</td>
<!--<td>${item['JobDetail'].jobClass}</td>-->
<td>${item['JobDetail'].jobClass}</td>
<td>
<#assign jobDataMap = item['JobDetail'].jobDataMap />
<#if jobDataMap?exists && jobDataMap?keys?size gt 0>
<#list jobDataMap?keys as key>
${key} = ${jobDataMap[key]} <br>
</#list>
<#if item['JobDetail'].jobDataMap?exists>
<#assign job_desc=item['JobDetail'].jobDataMap['job_desc'] />
${job_desc}
</#if>
</td>
<td state="${item['TriggerState']}" >
......@@ -79,9 +77,8 @@
<#elseif item['TriggerState'] == 'PAUSED'>
<button class="btn btn-info btn-xs job_operate" type="job_resume" type="button">恢复</button>
</#if>
<button class="btn btn-info btn-xs job_operate" type="job_trigger" type="button">执行一次</button>
<button class="btn btn-info btn-xs update" type="button">修改</button>
<button class="btn btn-danger btn-xs job_operate" type="job_del" type="button">删除</button>
<button class="btn btn-info btn-xs update" type="button">更新corn</button>
</p>
</td>
</tr>
......@@ -90,10 +87,10 @@
</tbody>
<tfoot>
<tr>
<th>调度key</th>
<th>任务ID</th>
<th>cron</th>
<!--<th>类路径</th>-->
<th>参数</th>
<th>Job类路径</th>
<th>简介</th>
<th>状态</th>
<th>操作</th>
</tr>
......@@ -117,35 +114,30 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" >新增调度信息</h4>
<h4 class="modal-title" >新增调度任务</h4>
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
<div class="form-group">
<label for="firstname" class="col-sm-3 control-label">任务Key</label>
<div class="col-sm-9"><input type="text" class="form-control" name="triggerKeyName" placeholder="请输入任务Key" minlength="4" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-3 control-label">任务Corn</label>
<div class="col-sm-9"><input type="text" class="form-control" name="cronExpression" placeholder="请输入任务Corn[允许修改]" maxlength="100" ></div>
<label for="firstname" class="col-sm-2 control-label">任务Key</label>
<div class="col-sm-10"><input type="text" class="form-control" name="triggerKeyName" placeholder="请输入任务Key" minlength="4" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-3 control-label">任务描述</label>
<div class="col-sm-9"><input type="text" class="form-control" name="job_desc" placeholder="请输入任务描述[不支持修改]" maxlength="200" ></div>
<label for="lastname" class="col-sm-2 control-label">任务Corn</label>
<div class="col-sm-10"><input type="text" class="form-control" name="cronExpression" placeholder="请输入任务Corn[允许修改]" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-3 control-label">任务URL</label>
<div class="col-sm-9"><input type="text" class="form-control" name="job_url" placeholder="请输入任务URL[不支持修改]" maxlength="200" ></div>
<label for="lastname" class="col-sm-2 control-label">任务Impl</label>
<div class="col-sm-10"><input type="text" class="form-control" name="jobClassName" placeholder="请输入任务Impl[不支持修改]" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-3 control-label">任务handler</label>
<div class="col-sm-9"><input type="text" class="form-control" name="handleName" placeholder="请输入任务handler[不支持修改]" maxlength="200" ></div>
<label for="lastname" class="col-sm-2 control-label">任务描述</label>
<div class="col-sm-10"><input type="text" class="form-control" name="jobDesc" placeholder="请输入任务描述[不支持修改]" maxlength="200" ></div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" >保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-info pull-right addParam">+ arg</button>
</div>
</div>
</form>
......@@ -159,7 +151,7 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" >更新corn</h4>
<h4 class="modal-title" >更新配置</h4>
</div>
<div class="modal-body">
<form class="form-horizontal form" role="form" >
......@@ -172,6 +164,14 @@
<div class="col-sm-10"><input type="text" class="form-control" name="cronExpression" placeholder="请输入任务Corn" maxlength="100" ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">任务Impl</label>
<div class="col-sm-10"><input type="text" class="form-control" name="jobClassName" placeholder="请输入任务Impl" maxlength="100" readonly ></div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">任务描述</label>
<div class="col-sm-10"><input type="text" class="form-control" name="jobDesc" placeholder="请输入任务描述" maxlength="200" readonly ></div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" >保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
......
......@@ -3,7 +3,7 @@
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>dianping-job-web</display-name>
<display-name>xxl-job-admin</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
......
div.FixedHeader_Cloned th,
div.FixedHeader_Cloned td {
background-color: white !important;
}
div.FixedHeader_Cloned th,div.FixedHeader_Cloned td{background-color:white !important}
table.KeyTable th.focus,
table.KeyTable td.focus {
outline: 3px solid #3366FF;
outline-offset: -3px;
}
table.KeyTable th.focus,table.KeyTable td.focus{outline:3px solid #3366FF;outline-offset:-3px}
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child,
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child {
position: relative;
padding-left: 30px;
cursor: pointer;
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child:before {
top: 8px;
left: 4px;
height: 16px;
width: 16px;
display: block;
position: absolute;
color: white;
border: 2px solid white;
border-radius: 16px;
text-align: center;
line-height: 14px;
box-shadow: 0 0 3px #444;
box-sizing: content-box;
content: '+';
background-color: #31b131;
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child.dataTables_empty:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child.dataTables_empty:before {
display: none;
}
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td:first-child:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th:first-child:before {
content: '-';
background-color: #d33333;
}
table.dataTable.dtr-inline.collapsed > tbody > tr.child td:before {
display: none;
}
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child,
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child {
padding-left: 27px;
}
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > td:first-child:before,
table.dataTable.dtr-inline.collapsed.compact > tbody > tr > th:first-child:before {
top: 5px;
left: 4px;
height: 14px;
width: 14px;
border-radius: 14px;
line-height: 12px;
}
table.dataTable.dtr-column > tbody > tr > td.control,
table.dataTable.dtr-column > tbody > tr > th.control {
position: relative;
cursor: pointer;
}
table.dataTable.dtr-column > tbody > tr > td.control:before,
table.dataTable.dtr-column > tbody > tr > th.control:before {
top: 50%;
left: 50%;
height: 16px;
width: 16px;
margin-top: -10px;
margin-left: -10px;
display: block;
position: absolute;
color: white;
border: 2px solid white;
border-radius: 16px;
text-align: center;
line-height: 14px;
box-shadow: 0 0 3px #444;
box-sizing: content-box;
content: '+';
background-color: #31b131;
}
table.dataTable.dtr-column > tbody > tr.parent td.control:before,
table.dataTable.dtr-column > tbody > tr.parent th.control:before {
content: '-';
background-color: #d33333;
}
table.dataTable > tbody > tr.child {
padding: 0.5em 1em;
}
table.dataTable > tbody > tr.child:hover {
background: transparent !important;
}
table.dataTable > tbody > tr.child ul {
display: inline-block;
list-style-type: none;
margin: 0;
padding: 0;
}
table.dataTable > tbody > tr.child ul li {
border-bottom: 1px solid #efefef;
padding: 0.5em 0;
}
table.dataTable > tbody > tr.child ul li:first-child {
padding-top: 0;
}
table.dataTable > tbody > tr.child ul li:last-child {
border-bottom: none;
}
table.dataTable > tbody > tr.child span.dtr-title {
display: inline-block;
min-width: 75px;
font-weight: bold;
}
<!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="../../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"></script>
<title>Responsive examples - Child row control</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Responsive example <span>Child row control</span></h1>
<div class="info">
<p>When a column is removed from display by Responsive, the data is still available in the table and can be displayed in a DataTables <em>child row</em> (see
<a href="//datatables.net/reference/api/row().child()"><code class="api" title="DataTables API method">row().child()<span>DT</span></code></a>). By default
Responsive will show child row controls in the first column when the table has been collapsed, allowing the end user to show / hide the information from the hidden
columns.</p>
<p>Responsive has a number of options for display of the child rows:</p>
<ul class="markdown">
<li>If child row display is enabled: <a href="//datatables.net/extensions/responsive/reference/option/responsive.details"><code class="option" title=
"Responsive initialisation option">responsive.details<span>R</span></code></a></li>
<li>How the show / hide control is displayed: <a href="//datatables.net/extensions/responsive/reference/option/responsive.details.type"><code class="option"
title="Responsive initialisation option">responsive.details.type<span>R</span></code></a></li>
<li>How the child row is rendered: <a href="//datatables.net/extensions/responsive/reference/option/responsive.details.renderer"><code class="option" title=
"Responsive initialisation option">responsive.details.renderer<span>R</span></code></a></li>
</ul>
<p>This section shows examples of these options being used.</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">Child rows</a></h3>
<ul class="toc">
<li><a href="./disable-child-rows.html">Disable child rows</a></li>
<li><a href="./column-control.html">Column controlled child rows</a></li>
<li><a href="./right-column.html">Column control - right</a></li>
<li><a href="./whole-row-control.html">Whole row child row control</a></li>
<li><a href="./custom-renderer.html">Custom child row renderer</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-2015<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
<!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="../../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"></script>
<title>Responsive examples - Display control</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Responsive example <span>Display control</span></h1>
<div class="info">
<p>Responsive has two basic modes of operation for controlling the visibility of columns at different display sizes. These two modes can be using either separately
or together:</p>
<ul class="markdown">
<li>Manually assigned class names for breakpoints - Assign a column a class name to tell Responsive which breakpoint(s) to show it in.</li>
<li>Automatically - for columns without a breakpoint class name, it will be automatically removed if there is no room available on screen to show it. Columns
are removed from the right, moving left.</li>
</ul>
<p>This section explores these two options.</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">Display control</a></h3>
<ul class="toc">
<li><a href="./auto.html">Automatic column hiding</a></li>
<li><a href="./classes.html">Class control</a></li>
<li><a href="./init-classes.html">Assigned class control</a></li>
<li><a href="./fixedHeader.html">With FixedHeader</a></li>
<li><a href="./complexHeader.html">Complex headers (rowspan / colspan)</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-2015<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
<!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="../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
<title>Responsive examples - Responsive DataTables</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Responsive example <span>Responsive DataTables</span></h1>
<div class="info"></div>
</section>
</div>
<section>
<div class="footer">
<div class="gradient"></div>
<div class="liner">
<div class="toc">
<div class="toc-group">
<h3><a href="./initialisation/index.html">Basic initialisation</a></h3>
<ul class="toc">
<li><a href="./initialisation/className.html">Class name</a></li>
<li><a href="./initialisation/option.html">Configuration option</a></li>
<li><a href="./initialisation/new.html">`new` constructor</a></li>
<li><a href="./initialisation/ajax.html">Ajax data</a></li>
<li><a href="./initialisation/default.html">Default initialisation</a></li>
</ul>
</div>
<div class="toc-group">
<h3><a href="./styling/index.html">Styling</a></h3>
<ul class="toc">
<li><a href="./styling/bootstrap.html">Bootstrap styling</a></li>
<li><a href="./styling/foundation.html">Foundation styling</a></li>
<li><a href="./styling/scrolling.html">Vertical scrolling</a></li>
<li><a href="./styling/compact.html">Compact styling</a></li>
</ul>
</div>
<div class="toc-group">
<h3><a href="./display-control/index.html">Display control</a></h3>
<ul class="toc">
<li><a href="./display-control/auto.html">Automatic column hiding</a></li>
<li><a href="./display-control/classes.html">Class control</a></li>
<li><a href="./display-control/init-classes.html">Assigned class control</a></li>
<li><a href="./display-control/fixedHeader.html">With FixedHeader</a></li>
<li><a href="./display-control/complexHeader.html">Complex headers (rowspan / colspan)</a></li>
</ul>
</div>
<div class="toc-group">
<h3><a href="./child-rows/index.html">Child rows</a></h3>
<ul class="toc">
<li><a href="./child-rows/disable-child-rows.html">Disable child rows</a></li>
<li><a href="./child-rows/column-control.html">Column controlled child rows</a></li>
<li><a href="./child-rows/right-column.html">Column control - right</a></li>
<li><a href="./child-rows/whole-row-control.html">Whole row child row control</a></li>
<li><a href="./child-rows/custom-renderer.html">Custom child row renderer</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-2015<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
<!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="../../../../examples/resources/syntax/shCore.js"></script>
<script type="text/javascript" language="javascript" src="../../../../examples/resources/demo.js"></script>
<title>Responsive examples - Initialisation</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Responsive example <span>Initialisation</span></h1>
<div class="info">
<p>Responsive can be run on a DataTable in a number of different ways:</p>
<ul class="markdown">
<li>By adding the class <code>responsive</code> or <code>dt-responsive</code> to the <code class="tag" title="HTML tag">table</code></li>
<li>Using the <a href="//datatables.net/extensions/responsive/reference/option/responsive"><code class="option" title=
"Responsive initialisation option">responsive<span>R</span></code></a> option in the DataTables initialisation</li>
<li>Use the <code>$.fn.dataTable.Responsive</code> constructor.</li>
</ul>
<p>This set of examples demonstrates these initialisation options.</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">Basic initialisation</a></h3>
<ul class="toc">
<li><a href="./className.html">Class name</a></li>
<li><a href="./option.html">Configuration option</a></li>
<li><a href="./new.html">`new` constructor</a></li>
<li><a href="./ajax.html">Ajax data</a></li>
<li><a href="./default.html">Default initialisation</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-2015<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
......@@ -9,25 +9,18 @@
<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>Responsive examples - Display control</title>
<title>Responsive examples - Styling</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Responsive example <span>Display control</span></h1>
<h1>Responsive example <span>Styling</span></h1>
<div class="info">
<p>Responsive has two basic modes of operation for controlling the visibility of columns at different display sizes. These two modes can be using either separately
or together:</p>
<ul class="markdown">
<li>Manually assigned class names for breakpoints - Assign a column a class name to tell Responsive which breakpoint(s) to show it in.</li>
<li>Automatically - for columns without a breakpoint class name, it will be automatically removed if there is no room available on screen to show it. Columns
are removed from the right, moving left.</li>
</ul>
<p>This section explores these two options.</p>
<p>Responsive requires very little styling information of its own, with styling needed only for the child row display when the table has been collapsed. As such,
integrating Responsive with your application should be as simple as including the Javascript and base stylesheet! This section shows Responsive being styling using
external CSS frameworks.</p>
</div>
</section>
</div>
......@@ -39,13 +32,12 @@
<div class="liner">
<div class="toc">
<div class="toc-group">
<h3><a href="./index.html">Display control</a></h3>
<h3><a href="./index.html">Styling</a></h3>
<ul class="toc">
<li><a href="./auto.html">Automatic column hiding</a></li>
<li><a href="./classes.html">Class control</a></li>
<li><a href="./init-classes.html">Assigned class control</a></li>
<li><a href="./fixedHeader.html">With FixedHeader</a></li>
<li><a href="./complexHeader.html">Complex headers (rowspan / colspan)</a></li>
<li><a href="./bootstrap.html">Bootstrap styling</a></li>
<li><a href="./foundation.html">Foundation styling</a></li>
<li><a href="./scrolling.html">Vertical scrolling</a></li>
<li><a href="./compact.html">Compact styling</a></li>
</ul>
</div>
</div>
......
# Scroller
Scroller is a virtual rendering plug-in for DataTables which allows large datasets to be drawn on screen every quickly. What the virtual rendering means is that only the visible portion of the table (and a bit to either side to make the scrolling smooth) is drawn, while the scrolling container gives the visual impression that the whole table is visible. This is done by making use of the pagination abilities of DataTables and moving the table around in the scrolling container DataTables adds to the page. The scrolling container is forced to the height it would be for the full table display using an extra element.
Key features include:
* Speed! The aim of Scroller for DataTables is to make rendering large data sets fast
* Full compatibility with DataTables' deferred rendering for maximum speed
* Integration with state saving in DataTables (scrolling position is saved)
* Support for scrolling with millions of rows
* Easy to use
# Installation
To use Scroller, first download DataTables ( http://datatables.net/download ) and place the unzipped Scroller 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
Scroller is initialised by simply including the letter `dt-string S` in the `dt-init dom` for the table you want to have this feature enabled on. Note that the `dt-string S` must come after the `dt-string t` parameter in `dom`. For example:
```js
$(document).ready( function () {
$('#example').DataTable( {
dom: 'lfrtipS'
} );
} );
```
Note that rows in the table must all be the same height. Information in a cell which expands on to multiple lines will cause some odd behaviour in the scrolling. Additionally, the table's `cellspacing` parameter must be set to 0, again to ensure the information display is correct.
# Documentation / support
* Documentation: http://datatables.net/extensions/scroller/
* DataTables support forums: http://datatables.net/forums
# GitHub
If you fancy getting involved with the development of Scroller and help make it better, please refer to its GitHub repo: https://github.com/DataTables/Scroller
<!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>Scroller example - API</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.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.scroller.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( {
ajax: "data/2500.txt",
deferRender: true,
dom: "frtiS",
scrollY: 200,
scrollCollapse: true,
initComplete: function () {
var api = this.api();
api.scroller().scrollToRow( 1000 );
}
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>API</span></h1>
<div class="info">
<p>This example shows a trivial use of the API methods that Scroller adds to the DataTables API to
scroll to a row once the table's data has been loaded. In this case
<code>scroller().scrollToRow()</code> is used to jump to row 1000.</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</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( {
ajax: &quot;data/2500.txt&quot;,
deferRender: true,
dom: &quot;frtiS&quot;,
scrollY: 200,
scrollCollapse: true,
initComplete: function () {
var api = this.api();
api.scroller().scrollToRow( 1000 );
}
} );
} );</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.scroller.js">../js/dataTables.scroller.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.scroller.css">../css/dataTables.scroller.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="./state_saving.html">State saving</a></li>
<li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li class="active"><a href="./api_scrolling.html">API</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
<!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>Scroller examples - Scroller examples</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>Scroller examples</span></h1>
<div class="info">
<p>Scroller is a virtual rendering plug-in for DataTables which allows large datasets to be drawn on
screen every quickly. What the virtual rendering means is that only the visible portion of the table
(and a bit to either side to make the scrolling smooth) is drawn, while the scrolling container gives
the visual impression that the whole table is visible. This is done by making use of the pagination
abilities of DataTables and moving the table around in the scrolling container DataTables adds to the
page. The scrolling container is forced to the height it would be for the full table display using an
extra element.</p>
<p>Scroller is initialised by simply including the letter <code>S</code> in the <a href=
"//datatables.net/reference/option/dom"><code class="option" title=
"DataTables initialisation option">dom<span>DT</span></code></a> for the table you want to have this
feature enabled on. Note that the <code>S</code> must come after the <code>t</code> parameter in
<a href="//datatables.net/reference/option/dom"><code class="option" title=
"DataTables initialisation option">dom<span>DT</span></code></a>.</p>
<p>Key features include:</p>
<ul class="markdown">
<li>Speed! The aim of Scroller for DataTables is to make rendering large data sets fast</li>
<li>Full compatibility with DataTables' deferred rendering for maximum speed</li>
<li>Integration with state saving in DataTables (scrolling position is saved)</li>
<li>Easy to use</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="./state_saving.html">State saving</a></li>
<li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li><a href="./api_scrolling.html">API</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
<!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>Scroller example - Client-side data source (50,000 rows)</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.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.scroller.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 data = [];
for ( var i=0 ; i<50000 ; i++ ) {
data.push( [ i, i, i, i, i ] );
}
var oTable = $('#example').dataTable( {
data: data,
deferRender: true,
dom: "frtiS",
scrollY: 200,
scrollCollapse: true
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>Client-side data source (50,000 rows)</span></h1>
<div class="info">
<p>This example is completely artificial in that the data generated is created on the client-side by
just looping around a Javascript array and then passing that to DataTables. However, it does show quite
nicely that DataTables and Scroller can cope with large amounts of data on the client-side quite
nicely. Typically data such as this would be Ajax sourced and server-side processing should be
considered.</p>
<p>Please be aware that the performance of this page will depend on your browser as the array of data
is generated - for example IE6 will crawl!</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</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 data = [];
for ( var i=0 ; i&lt;50000 ; i++ ) {
data.push( [ i, i, i, i, i ] );
}
var oTable = $('#example').dataTable( {
data: data,
deferRender: true,
dom: &quot;frtiS&quot;,
scrollY: 200,
scrollCollapse: true
} );
} );</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.scroller.js">../js/dataTables.scroller.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.scroller.css">../css/dataTables.scroller.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="./state_saving.html">State saving</a></li>
<li class="active"><a href="./large_js_source.html">Client-side data source (50,000
rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li><a href="./api_scrolling.html">API</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
<!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>Scroller example - Basic initialisation</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.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.scroller.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( {
ajax: "data/2500.txt",
deferRender: true,
dom: "frtiS",
scrollY: 200,
scrollCollapse: true
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>Basic initialisation</span></h1>
<div class="info">
<p>Scroller is a plug-in for DataTables which enhances DataTables' built-in scrolling features to allow
large amounts of data to be rendered on page very quickly. This is done by Scroller through the use of
a virtual rendering technique that will render only the part of the table that is actually required for
the current view.</p>
<p>Note that Scroller assumes that all rows are of the same height (in order to preform the required
calculations. You can use <code>td { white-space: nowrap; }</code> in your CSS to ensure that text in
rows does not wrap.</p>
<p>This example shows how Scroller for DataTables can be initialised by simply including the character
<code>S</code> in sDom (note that the <code>S</code> must come after the <code>t</code> in sDom).
Deferred rendering an and Ajax data source are also used in this example.</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</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( {
ajax: &quot;data/2500.txt&quot;,
deferRender: true,
dom: &quot;frtiS&quot;,
scrollY: 200,
scrollCollapse: true
} );
} );</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.scroller.js">../js/dataTables.scroller.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.scroller.css">../css/dataTables.scroller.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 class="active"><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./state_saving.html">State saving</a></li>
<li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li><a href="./api_scrolling.html">API</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
<!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>Scroller example - State saving</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.scroller.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.scroller.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( {
ajax: "data/2500.txt",
deferRender: true,
dom: "frtiS",
scrollY: 200,
scrollCollapse: true,
stateSave: true
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>Scroller example <span>State saving</span></h1>
<div class="info">
<p>Scroller will automatically integrate with DataTables in order to save the scrolling position of the
table, if state saving is enabled in the DataTable (<a href=
"//datatables.net/reference/option/stateSave"><code class="option" title=
"DataTables initialisation option">stateSave<span>DT</span></code></a>). This example shows that in
practice - to demonstrate, scroll the table and then reload the page.</p>
</div>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>ZIP / Post code</th>
<th>Country</th>
</tr>
</thead>
</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( {
ajax: &quot;data/2500.txt&quot;,
deferRender: true,
dom: &quot;frtiS&quot;,
scrollY: 200,
scrollCollapse: true,
stateSave: true
} );
} );</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.scroller.js">../js/dataTables.scroller.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.scroller.css">../css/dataTables.scroller.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 class="active"><a href="./state_saving.html">State saving</a></li>
<li><a href="./large_js_source.html">Client-side data source (50,000 rows)</a></li>
<li><a href="./server-side_processing.html">Server-side processing (5,000,000
rows)</a></li>
<li><a href="./api_scrolling.html">API</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
div.DTTT_container{position:relative;float:right;margin-bottom:1em}@media screen and (max-width: 640px){div.DTTT_container{float:none !important;text-align:center}div.DTTT_container:after{visibility:hidden;display:block;content:"";clear:both;height:0}}button.DTTT_button,div.DTTT_button,a.DTTT_button{position:relative;display:inline-block;margin-right:3px;padding:5px 8px;border:1px solid #999;cursor:pointer;*cursor:hand;font-size:0.88em;color:black !important;-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 )}button.DTTT_button{height:30px;padding:3px 8px}.DTTT_button embed{outline:none}button.DTTT_button:hover:not(.DTTT_disabled),div.DTTT_button:hover:not(.DTTT_disabled),a.DTTT_button:hover:not(.DTTT_disabled){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.DTTT_button:focus,div.DTTT_button:focus,a.DTTT_button:focus{border:1px solid #426c9e;text-shadow:0 1px 0 #c4def1;outline:none;background-color:#a3d0ef 100%;background-image:-webkit-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);background-image:-moz-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);background-image:-ms-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);background-image:-o-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);background-image:linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#a3d0ef', EndColorStr='#a3d0ef')}button.DTTT_button:active:not(.DTTT_disabled),div.DTTT_button:active:not(.DTTT_disabled),a.DTTT_button:active:not(.DTTT_disabled){-webkit-box-shadow:inset 1px 1px 3px #999999;-moz-box-shadow:inset 1px 1px 3px #999999;box-shadow:inset 1px 1px 3px #999999}button.DTTT_disabled,div.DTTT_disabled,a.DTTT_disabled{color:#999 !important;border:1px solid #d0d0d0;cursor:default;background:#ffffff;background:-webkit-linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);background:-moz-linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);background:-ms-linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);background:-o-linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);background:linear-gradient(top, #fff 0%, #f9f9f9 89%, #fafafa 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#fafafa',GradientType=0 )}button.DTTT_button_collection span{padding-right:17px;background:url(../images/collection.png) no-repeat center right}button.DTTT_button_collection:hover span{padding-right:17px;background:#f0f0f0 url(../images/collection_hover.png) no-repeat center right}table.DTTT_selectable tbody tr{cursor:pointer;*cursor:hand}table.dataTable tr.DTTT_selected.odd{background-color:#9FAFD1}table.dataTable tr.DTTT_selected.odd td.sorting_1{background-color:#9FAFD1}table.dataTable tr.DTTT_selected.odd td.sorting_2{background-color:#9FAFD1}table.dataTable tr.DTTT_selected.odd td.sorting_3{background-color:#9FAFD1}table.dataTable tr.DTTT_selected.even{background-color:#B0BED9}table.dataTable tr.DTTT_selected.even td.sorting_1{background-color:#B0BED9}table.dataTable tr.DTTT_selected.even td.sorting_2{background-color:#B0BED9}table.dataTable tr.DTTT_selected.even td.sorting_3{background-color:#B0BED9}div.DTTT_collection{width:150px;padding:8px 8px 4px 8px;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)}div.DTTT_collection_background{background:black;z-index:2001}div.DTTT_collection button.DTTT_button,div.DTTT_collection div.DTTT_button,div.DTTT_collection a.DTTT_button{position:relative;left:0;right:0;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}.DTTT_print_info{position:fixed;top:50%;left:50%;width:400px;height:150px;margin-left:-200px;margin-top:-75px;text-align:center;color:#333;padding:10px 30px;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 );opacity:0.95;border:1px solid black;border:1px solid rgba(0,0,0,0.5);-webkit-border-radius:6px;-moz-border-radius:6px;-ms-border-radius:6px;-o-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.5);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.5);-ms-box-shadow:0 3px 7px rgba(0,0,0,0.5);-o-box-shadow:0 3px 7px rgba(0,0,0,0.5);box-shadow:0 3px 7px rgba(0,0,0,0.5)}.DTTT_print_info h6{font-weight:normal;font-size:28px;line-height:28px;margin:1em}.DTTT_print_info p{font-size:14px;line-height:20px}
<!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>TableTools example - Ajax loaded data</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.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.tableTools.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: 'T<"clear">lfrtip',
"ajax": "../../../../examples/ajax/data/objects.txt",
"columns": [
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "extn" },
{ "data": "start_date" },
{ "data": "salary" }
],
deferRender: true
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>TableTools example <span>Ajax loaded data</span></h1>
<div class="info">
<p>This TableTools example shows DataTables using its ability to <a href="//datatables.net/manual/data#Objects">Ajax load object based data</a> and operate in
exactly the same manner as when the data is read directly from the document.</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 language-js">$(document).ready(function() {
$('#example').DataTable( {
dom: 'T&lt;&quot;clear&quot;&gt;lfrtip',
&quot;ajax&quot;: &quot;../../../../examples/ajax/data/objects.txt&quot;,
&quot;columns&quot;: [
{ &quot;data&quot;: &quot;name&quot; },
{ &quot;data&quot;: &quot;position&quot; },
{ &quot;data&quot;: &quot;office&quot; },
{ &quot;data&quot;: &quot;extn&quot; },
{ &quot;data&quot;: &quot;start_date&quot; },
{ &quot;data&quot;: &quot;salary&quot; }
],
deferRender: true
} );
} );</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.tableTools.js">../js/dataTables.tableTools.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 language-css"></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.tableTools.css">../css/dataTables.tableTools.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="./swf_path.html">Setting the SWF path</a></li>
<li><a href="./new_init.html">Initialisation with `new`</a></li>
<li><a href="./defaults.html">Defaults</a></li>
<li><a href="./select_single.html">Row selection - single row select</a></li>
<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
<li><a href="./select_os.html">Row selection - operating system style</a></li>
<li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multi_instance.html">Multiple toolbars</a></li>
<li><a href="./collection.html">Button collections</a></li>
<li><a href="./plug-in.html">Plug-in button types</a></li>
<li><a href="./button_text.html">Custom button text</a></li>
<li><a href="./alter_buttons.html">Button arrangement</a></li>
<li class="active"><a href="./ajax.html">Ajax loaded data</a></li>
<li><a href="./pdf_message.html">PDF message</a></li>
<li><a href="./bootstrap.html">Bootstrap styling</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-2015<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
<!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>TableTools examples - TableTools examples</title>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>TableTools example <span>TableTools examples</span></h1>
<div class="info">
<p>TableTools is a plug-in for the DataTables HTML table enhancer, which adds a highly customisable button toolbar to a DataTable. Key features include:</p>
<ul class="markdown">
<li>Copy to clipboard</li>
<li>Save table data as CSV, XLS or PDF files</li>
<li>Print view for clean printing</li>
<li>Row selection options</li>
<li>Easy use predefined buttons</li>
<li>Simple customisation of buttons</li>
<li>Well defined API for advanced control</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="./swf_path.html">Setting the SWF path</a></li>
<li><a href="./new_init.html">Initialisation with `new`</a></li>
<li><a href="./defaults.html">Defaults</a></li>
<li><a href="./select_single.html">Row selection - single row select</a></li>
<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
<li><a href="./select_os.html">Row selection - operating system style</a></li>
<li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multi_instance.html">Multiple toolbars</a></li>
<li><a href="./collection.html">Button collections</a></li>
<li><a href="./plug-in.html">Plug-in button types</a></li>
<li><a href="./button_text.html">Custom button text</a></li>
<li><a href="./alter_buttons.html">Button arrangement</a></li>
<li><a href="./ajax.html">Ajax loaded data</a></li>
<li><a href="./pdf_message.html">PDF message</a></li>
<li><a href="./bootstrap.html">Bootstrap styling</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-2015<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
<!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>TableTools example - Multiple tables</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.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.tableTools.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: 'T<"clear">lfrtip'
} );
} );
</script>
</head>
<body class="dt-example">
<div class="container">
<section>
<h1>TableTools example <span>Multiple tables</span></h1>
<div class="info">
<p>This example shows how multiple tables can be initialised with DataTables and TableTools in a single call to the <code>$().DataTable()</code> function.
Basically it works as you would expect - no special considerations need be made!</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 language-js">$(document).ready(function() {
$('#example').DataTable( {
dom: 'T&lt;&quot;clear&quot;&gt;lfrtip'
} );
} );</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.tableTools.js">../js/dataTables.tableTools.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 language-css"></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.tableTools.css">../css/dataTables.tableTools.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="./swf_path.html">Setting the SWF path</a></li>
<li><a href="./new_init.html">Initialisation with `new`</a></li>
<li><a href="./defaults.html">Defaults</a></li>
<li><a href="./select_single.html">Row selection - single row select</a></li>
<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
<li><a href="./select_os.html">Row selection - operating system style</a></li>
<li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li class="active"><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multi_instance.html">Multiple toolbars</a></li>
<li><a href="./collection.html">Button collections</a></li>
<li><a href="./plug-in.html">Plug-in button types</a></li>
<li><a href="./button_text.html">Custom button text</a></li>
<li><a href="./alter_buttons.html">Button arrangement</a></li>
<li><a href="./ajax.html">Ajax loaded data</a></li>
<li><a href="./pdf_message.html">PDF message</a></li>
<li><a href="./bootstrap.html">Bootstrap styling</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-2015<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
......@@ -5,13 +5,27 @@
<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>TableTools example - Ajax loaded data</title>
<title>TableTools example - Row selection - row selector on specific cells</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.css">
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.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">
tr td:first-child {
text-align: center;
}
tr td:first-child:before {
content: "\f096"; /* fa-square-o */
font-family: FontAwesome;
}
tr.selected td:first-child:before {
content: "\f046"; /* fa-check-square-o */
}
</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>
......@@ -21,19 +35,26 @@
<script type="text/javascript" language="javascript" class="init">
$(document).ready(function() {
$('#example').DataTable( {
dom: 'T<"clear">lfrtip',
"ajax": "../../../../examples/ajax/data/objects.txt",
"columns": [
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "extn" },
{ "data": "start_date" },
{ "data": "salary" }
ajax: "../../../examples/ajax/data/objects.txt",
columns: [
{ data: null, defaultContent: '', orderable: false },
{ data: 'name' },
{ data: 'position' },
{ data: 'office' },
{ data: 'extn' },
{ data: 'start_date' },
{ data: 'salary' }
],
deferRender: true
order: [ 1, 'asc' ],
dom: 'T<"clear">lfrtip',
tableTools: {
sRowSelect: 'os',
sRowSelector: 'td:first-child',
aButtons: [ 'select_all', 'select_none' ]
}
} );
} );
......@@ -44,35 +65,33 @@ $(document).ready(function() {
<body class="dt-example">
<div class="container">
<section>
<h1>TableTools example <span>Ajax loaded data</span></h1>
<h1>TableTools example <span>Row selection - row selector on specific cells</span></h1>
<div class="info">
<p>This TableTools example shows DataTables using its ability to <a href="//datatables.net/manual/data#Objects">Ajax load object based data</a> and operate in
exactly the same manner as when the data is read directly from the document.</p>
<p>By default, TableTools' row selector option will register a row selection click on any part of the row. Although this is often desirable, you might wish at
times to limit the row selection to just a single column, or other elements in the row. This might be useful, for example, with <a href=
"//editor.datatables.net">Editor's</a> inline editing, so you don't select the row on click of a cell that is to be edited.</p>
<p>The <code>sRowSelector</code> method provides this ability, allowing a custom jQuery selector to be passed in. TableTools will use the parent row of any element
that is selected by the end user.</p>
<p>In this case, the row selector is attached to the cells in the first column of the table, and <a href="http://fortawesome.github.io/Font-Awesome">Font
Awesome</a> is used to display a checkbox indicating the selection state of the row, in addition to the row background colouring.</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>
<th>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</thead>
</table>
<ul class="tabs">
......@@ -87,17 +106,23 @@ $(document).ready(function() {
<div class="js">
<p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
$('#example').DataTable( {
dom: 'T&lt;&quot;clear&quot;&gt;lfrtip',
&quot;ajax&quot;: &quot;../../../../examples/ajax/data/objects.txt&quot;,
&quot;columns&quot;: [
{ &quot;data&quot;: &quot;name&quot; },
{ &quot;data&quot;: &quot;position&quot; },
{ &quot;data&quot;: &quot;office&quot; },
{ &quot;data&quot;: &quot;extn&quot; },
{ &quot;data&quot;: &quot;start_date&quot; },
{ &quot;data&quot;: &quot;salary&quot; }
ajax: &quot;../../../examples/ajax/data/objects.txt&quot;,
columns: [
{ data: null, defaultContent: '', orderable: false },
{ data: 'name' },
{ data: 'position' },
{ data: 'office' },
{ data: 'extn' },
{ data: 'start_date' },
{ data: 'salary' }
],
deferRender: true
order: [ 1, 'asc' ],
dom: 'T&lt;&quot;clear&quot;&gt;lfrtip',
tableTools: {
sRowSelect: 'os',
sRowSelector: 'td:first-child',
aButtons: [ 'select_all', 'select_none' ]
}
} );
} );</code>
......@@ -117,7 +142,18 @@ $(document).ready(function() {
<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 language-css"></code>
additional CSS used is shown below:</p><code class="multiline language-css">tr td:first-child {
text-align: center;
}
tr td:first-child:before {
content: &quot;\f096&quot;; /* fa-square-o */
font-family: FontAwesome;
}
tr.selected td:first-child:before {
content: &quot;\f046&quot;; /* fa-check-square-o */
}</code>
</div>
<p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
......@@ -125,6 +161,8 @@ $(document).ready(function() {
<ul>
<li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
<li><a href="../css/dataTables.tableTools.css">../css/dataTables.tableTools.css</a></li>
<li><a href=
"//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css">//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css</a></li>
</ul>
</div>
......@@ -160,14 +198,14 @@ $(document).ready(function() {
<li><a href="./select_single.html">Row selection - single row select</a></li>
<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
<li><a href="./select_os.html">Row selection - operating system style</a></li>
<li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li class="active"><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multi_instance.html">Multiple toolbars</a></li>
<li><a href="./collection.html">Button collections</a></li>
<li><a href="./plug-in.html">Plug-in button types</a></li>
<li><a href="./button_text.html">Custom button text</a></li>
<li><a href="./alter_buttons.html">Button arrangement</a></li>
<li class="active"><a href="./ajax.html">Ajax loaded data</a></li>
<li><a href="./ajax.html">Ajax loaded data</a></li>
<li><a href="./pdf_message.html">PDF message</a></li>
<li><a href="./bootstrap.html">Bootstrap styling</a></li>
<li><a href="./jqueryui.html">jQuery UI styling</a></li>
......
......@@ -5,7 +5,7 @@
<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>TableTools example - Multiple tables</title>
<title>TableTools example - Setting the SWF path</title>
<link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="../css/dataTables.tableTools.css">
<link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
......@@ -23,7 +23,10 @@
$(document).ready(function() {
$('#example').DataTable( {
dom: 'T<"clear">lfrtip'
dom: 'T<"clear">lfrtip',
tableTools: {
"sSwfPath": "../swf/copy_csv_xls_pdf.swf"
}
} );
} );
......@@ -34,20 +37,25 @@ $(document).ready(function() {
<body class="dt-example">
<div class="container">
<section>
<h1>TableTools example <span>Multiple tables</span></h1>
<h1>TableTools example <span>Setting the SWF path</span></h1>
<div class="info">
<p>This example shows how multiple tables can be initialised with DataTables and TableTools in a single call to the <code>$().DataTable()</code> function.
Basically it works as you would expect - no special considerations need be made!</p>
<p>TableTools uses a Flash SWF file to provide the ability to copy text to the system clipboard and save files locally. TableTools must be able to load the SWF
file in order to provide these facilities. If you aren't using the same directory structure as the TableTools package, you will need to set the
<code>sSwfPath</code> TableTools parameter, as shown in this example.</p>
<p>Note that TableTools ships with two different SWF files - the only difference between them is that one of them provides the ability to save PDF files while the
other doesn't. The trade off is that the PDF capable file is significantly larger in size (56K v 2K).</p>
</div>
<table id="" class="display" cellspacing="0" width="100%">
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
......@@ -58,6 +66,7 @@ $(document).ready(function() {
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
......@@ -68,101 +77,111 @@ $(document).ready(function() {
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</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>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>$103,600</td>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Quinn Flynn</td>
<td>Support Lead</td>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>$342,000</td>
<td>2012/03/29</td>
<td>$433,060</td>
</tr>
<tr>
<td>Dai Rios</td>
<td>Personnel Lead</td>
<td>Edinburgh</td>
<td>35</td>
<td>$217,500</td>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008/11/28</td>
<td>$162,700</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>
<td>Brielle Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>2012/12/02</td>
<td>$372,000</td>
</tr>
<tr>
<td>Jennifer Acosta</td>
<td>Junior Javascript Developer</td>
<td>Edinburgh</td>
<td>43</td>
<td>$75,650</td>
<td>Herrod Chandler</td>
<td>Sales Assistant</td>
<td>San Francisco</td>
<td>59</td>
<td>2012/08/06</td>
<td>$137,500</td>
</tr>
<tr>
<td>Shad Decker</td>
<td>Regional Director</td>
<td>Edinburgh</td>
<td>51</td>
<td>$183,000</td>
<td>Rhona Davidson</td>
<td>Integration Specialist</td>
<td>Tokyo</td>
<td>55</td>
<td>2010/10/14</td>
<td>$327,900</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>
<td>Colleen Hurst</td>
<td>Javascript Developer</td>
<td>San Francisco</td>
<td>39</td>
<td>2009/09/15</td>
<td>$205,500</td>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Salary</th>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>2008/12/13</td>
<td>$103,600</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Jena Gaines</td>
<td>Office Manager</td>
<td>London</td>
<td>30</td>
<td>2008/12/19</td>
<td>$90,560</td>
</tr>
<tr>
<td>Quinn Flynn</td>
<td>Support Lead</td>
<td>Edinburgh</td>
<td>22</td>
<td>2013/03/03</td>
<td>$342,000</td>
</tr>
<tr>
<td>Charde Marshall</td>
<td>Regional Director</td>
<td>San Francisco</td>
<td>36</td>
<td>2008/10/16</td>
<td>$470,600</td>
</tr>
<tr>
<td>Haley Kennedy</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>43</td>
<td>2012/12/18</td>
<td>$313,500</td>
</tr>
<tr>
......@@ -170,6 +189,7 @@ $(document).ready(function() {
<td>Regional Director</td>
<td>London</td>
<td>19</td>
<td>2010/03/17</td>
<td>$385,750</td>
</tr>
<tr>
......@@ -177,27 +197,135 @@ $(document).ready(function() {
<td>Marketing Designer</td>
<td>London</td>
<td>66</td>
<td>2012/11/27</td>
<td>$198,500</td>
</tr>
<tr>
<td>Paul Byrd</td>
<td>Chief Financial Officer (CFO)</td>
<td>New York</td>
<td>64</td>
<td>2010/06/09</td>
<td>$725,000</td>
</tr>
<tr>
<td>Gloria Little</td>
<td>Systems Administrator</td>
<td>New York</td>
<td>59</td>
<td>2009/04/10</td>
<td>$237,500</td>
</tr>
<tr>
<td>Bradley Greer</td>
<td>Software Engineer</td>
<td>London</td>
<td>41</td>
<td>2012/10/13</td>
<td>$132,000</td>
</tr>
<tr>
<td>Dai Rios</td>
<td>Personnel Lead</td>
<td>Edinburgh</td>
<td>35</td>
<td>2012/09/26</td>
<td>$217,500</td>
</tr>
<tr>
<td>Jenette Caldwell</td>
<td>Development Lead</td>
<td>New York</td>
<td>30</td>
<td>2011/09/03</td>
<td>$345,000</td>
</tr>
<tr>
<td>Yuri Berry</td>
<td>Chief Marketing Officer (CMO)</td>
<td>New York</td>
<td>40</td>
<td>2009/06/25</td>
<td>$675,000</td>
</tr>
<tr>
<td>Caesar Vance</td>
<td>Pre-Sales Support</td>
<td>New York</td>
<td>21</td>
<td>2011/12/12</td>
<td>$106,450</td>
</tr>
<tr>
<td>Doris Wilder</td>
<td>Sales Assistant</td>
<td>Sidney</td>
<td>23</td>
<td>2010/09/20</td>
<td>$85,600</td>
</tr>
<tr>
<td>Angelica Ramos</td>
<td>Chief Executive Officer (CEO)</td>
<td>London</td>
<td>47</td>
<td>2009/10/09</td>
<td>$1,200,000</td>
</tr>
<tr>
<td>Gavin Joyce</td>
<td>Developer</td>
<td>Edinburgh</td>
<td>42</td>
<td>2010/12/22</td>
<td>$92,575</td>
</tr>
<tr>
<td>Jennifer Chang</td>
<td>Regional Director</td>
<td>Singapore</td>
<td>28</td>
<td>2010/11/14</td>
<td>$357,650</td>
</tr>
<tr>
<td>Brenden Wagner</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>28</td>
<td>2011/06/07</td>
<td>$206,850</td>
</tr>
<tr>
<td>Fiona Green</td>
<td>Chief Operating Officer (COO)</td>
<td>San Francisco</td>
<td>48</td>
<td>2010/03/11</td>
<td>$850,000</td>
</tr>
<tr>
<td>Shou Itou</td>
<td>Regional Marketing</td>
<td>Tokyo</td>
<td>20</td>
<td>2011/08/14</td>
<td>$163,000</td>
</tr>
<tr>
<td>Michelle House</td>
<td>Integration Specialist</td>
<td>Sidney</td>
<td>37</td>
<td>2011/06/02</td>
<td>$95,400</td>
</tr>
<tr>
<td>Suki Burks</td>
<td>Developer</td>
<td>London</td>
<td>53</td>
<td>2009/10/22</td>
<td>$114,500</td>
</tr>
<tr>
......@@ -205,27 +333,159 @@ $(document).ready(function() {
<td>Technical Author</td>
<td>London</td>
<td>27</td>
<td>2011/05/07</td>
<td>$145,000</td>
</tr>
<tr>
<td>Gavin Cortez</td>
<td>Team Leader</td>
<td>San Francisco</td>
<td>22</td>
<td>2008/10/26</td>
<td>$235,500</td>
</tr>
<tr>
<td>Martena Mccray</td>
<td>Post-Sales support</td>
<td>Edinburgh</td>
<td>46</td>
<td>2011/03/09</td>
<td>$324,050</td>
</tr>
<tr>
<td>Unity Butler</td>
<td>Marketing Designer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/12/09</td>
<td>$85,675</td>
</tr>
<tr>
<td>Howard Hatfield</td>
<td>Office Manager</td>
<td>San Francisco</td>
<td>51</td>
<td>2008/12/16</td>
<td>$164,500</td>
</tr>
<tr>
<td>Hope Fuentes</td>
<td>Secretary</td>
<td>San Francisco</td>
<td>41</td>
<td>2010/02/12</td>
<td>$109,850</td>
</tr>
<tr>
<td>Vivian Harrell</td>
<td>Financial Controller</td>
<td>San Francisco</td>
<td>62</td>
<td>2009/02/14</td>
<td>$452,500</td>
</tr>
<tr>
<td>Timothy Mooney</td>
<td>Office Manager</td>
<td>London</td>
<td>37</td>
<td>2008/12/11</td>
<td>$136,200</td>
</tr>
<tr>
<td>Jackson Bradshaw</td>
<td>Director</td>
<td>New York</td>
<td>65</td>
<td>2008/09/26</td>
<td>$645,750</td>
</tr>
<tr>
<td>Olivia Liang</td>
<td>Support Engineer</td>
<td>Singapore</td>
<td>64</td>
<td>2011/02/03</td>
<td>$234,500</td>
</tr>
<tr>
<td>Bruno Nash</td>
<td>Software Engineer</td>
<td>London</td>
<td>38</td>
<td>2011/05/03</td>
<td>$163,500</td>
</tr>
<tr>
<td>Sakura Yamamoto</td>
<td>Support Engineer</td>
<td>Tokyo</td>
<td>37</td>
<td>2009/08/19</td>
<td>$139,575</td>
</tr>
<tr>
<td>Thor Walton</td>
<td>Developer</td>
<td>New York</td>
<td>61</td>
<td>2013/08/11</td>
<td>$98,540</td>
</tr>
<tr>
<td>Finn Camacho</td>
<td>Support Engineer</td>
<td>San Francisco</td>
<td>47</td>
<td>2009/07/07</td>
<td>$87,500</td>
</tr>
<tr>
<td>Serge Baldwin</td>
<td>Data Coordinator</td>
<td>Singapore</td>
<td>64</td>
<td>2012/04/09</td>
<td>$138,575</td>
</tr>
<tr>
<td>Zenaida Frank</td>
<td>Software Engineer</td>
<td>New York</td>
<td>63</td>
<td>2010/01/04</td>
<td>$125,250</td>
</tr>
<tr>
<td>Zorita Serrano</td>
<td>Software Engineer</td>
<td>San Francisco</td>
<td>56</td>
<td>2012/06/01</td>
<td>$115,000</td>
</tr>
<tr>
<td>Jennifer Acosta</td>
<td>Junior Javascript Developer</td>
<td>Edinburgh</td>
<td>43</td>
<td>2013/02/01</td>
<td>$75,650</td>
</tr>
<tr>
<td>Cara Stevens</td>
<td>Sales Assistant</td>
<td>New York</td>
<td>46</td>
<td>2011/12/06</td>
<td>$145,600</td>
</tr>
<tr>
<td>Hermione Butler</td>
<td>Regional Director</td>
<td>London</td>
<td>47</td>
<td>2011/03/21</td>
<td>$356,250</td>
</tr>
<tr>
......@@ -233,8 +493,41 @@ $(document).ready(function() {
<td>Systems Administrator</td>
<td>London</td>
<td>21</td>
<td>2009/02/27</td>
<td>$103,500</td>
</tr>
<tr>
<td>Jonas Alexander</td>
<td>Developer</td>
<td>San Francisco</td>
<td>30</td>
<td>2010/07/14</td>
<td>$86,500</td>
</tr>
<tr>
<td>Shad Decker</td>
<td>Regional Director</td>
<td>Edinburgh</td>
<td>51</td>
<td>2008/11/13</td>
<td>$183,000</td>
</tr>
<tr>
<td>Michael Bruce</td>
<td>Javascript Developer</td>
<td>Singapore</td>
<td>29</td>
<td>2011/06/27</td>
<td>$183,000</td>
</tr>
<tr>
<td>Donna Snider</td>
<td>Customer Support</td>
<td>New York</td>
<td>27</td>
<td>2011/01/25</td>
<td>$112,000</td>
</tr>
</tbody>
</table>
......@@ -250,7 +543,10 @@ $(document).ready(function() {
<div class="js">
<p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
$('#example').DataTable( {
dom: 'T&lt;&quot;clear&quot;&gt;lfrtip'
dom: 'T&lt;&quot;clear&quot;&gt;lfrtip',
tableTools: {
&quot;sSwfPath&quot;: &quot;../swf/copy_csv_xls_pdf.swf&quot;
}
} );
} );</code>
......@@ -307,14 +603,14 @@ $(document).ready(function() {
<h3><a href="./index.html">Examples</a></h3>
<ul class="toc active">
<li><a href="./simple.html">Basic initialisation</a></li>
<li><a href="./swf_path.html">Setting the SWF path</a></li>
<li class="active"><a href="./swf_path.html">Setting the SWF path</a></li>
<li><a href="./new_init.html">Initialisation with `new`</a></li>
<li><a href="./defaults.html">Defaults</a></li>
<li><a href="./select_single.html">Row selection - single row select</a></li>
<li><a href="./select_multi.html">Row selection - multi-row select</a></li>
<li><a href="./select_os.html">Row selection - operating system style</a></li>
<li><a href="./select_column.html">Row selection - row selector on specific cells</a></li>
<li class="active"><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multiple_tables.html">Multiple tables</a></li>
<li><a href="./multi_instance.html">Multiple toolbars</a></li>
<li><a href="./collection.html">Button collections</a></li>
<li><a href="./plug-in.html">Plug-in button types</a></li>
......
......@@ -41,9 +41,6 @@ $(function() {
} else if ("job_del" == type) {
typeName = "删除";
url = base_url + "/job/remove";
} else if ("job_trigger" == type) {
typeName = "执行一次";
url = base_url + "/job/trigger";
} else {
return;
}
......@@ -73,16 +70,9 @@ $(function() {
});
});
// jquery.validate 自定义校验 “英文字母开头,只含有英文字母、数字和下划线”
jQuery.validator.addMethod("myValid01", function(value, element) {
var length = value.length;
var valid = /^[a-zA-Z][a-zA-Z0-9_]*$/;
return this.optional(element) || valid.test(value);
}, "只支持英文字母开头,只含有英文字母、数字和下划线");
// 新增
$(".add").click(function(){
$('#addModal').modal({backdrop: false, keyboard: false}).modal('show');
$('#addModal').modal('show');
});
var addModalValidate = $("#addModal .form").validate({
errorElement : 'span',
......@@ -92,22 +82,17 @@ $(function() {
triggerKeyName : {
required : true ,
minlength: 4,
maxlength: 100,
myValid01:true
maxlength: 100
},
cronExpression : {
required : true ,
maxlength: 100
},
job_desc : {
jobClassName : {
required : true ,
maxlength: 200
},
job_url : {
required : true ,
maxlength: 200
},
handleName : {
maxlength: 100
},
jobDesc : {
required : true ,
maxlength: 200
}
......@@ -115,24 +100,20 @@ $(function() {
messages : {
triggerKeyName : {
required :"请输入“任务Key”." ,
minlength:"“任务Key”长度不应低于4位",
maxlength:"“任务Key”长度不应超过100位"
minlength:"“任务Key”不应低于4位",
maxlength:"“任务Key”不应超过100位"
},
cronExpression : {
required :"请输入“任务Corn”." ,
maxlength:"“任务Corn”长度不应超过100位"
maxlength:"“任务Corn”不应超过100位"
},
job_desc : {
required :"请输入“任务描述”." ,
maxlength:"“任务描述”长度不应超过200位"
jobClassName : {
required :"请输入“任务Impl”." ,
maxlength:"“任务Impl”不应超过100位"
},
job_url : {
required :"请输入“任务URL”." ,
maxlength:"“任务URL”长度不应超过200位"
},
handleName : {
required : "请输入“任务handler”." ,
maxlength: "“任务handler”长度不应超过200位"
jobDesc : {
required :"请输入“任务描述”." ,
maxlength:"“任务描述”不应超过200位"
}
},
highlight : function(element) {
......@@ -146,77 +127,32 @@ $(function() {
element.parent('div').append(error);
},
submitHandler : function(form) {
var triggerKeyName = $('#addModal input[name="triggerKeyName"]').val();
var cronExpression = $('#addModal input[name="cronExpression"]').val();
var job_desc = $('#addModal input[name="job_desc"]').val();
var job_url = $('#addModal input[name="job_url"]').val();
var handleName = $('#addModal input[name="handleName"]').val();
var paramStr = 'triggerKeyName=' + triggerKeyName +
'&cronExpression=' + cronExpression +
'&job_desc=' + job_desc +
'&job_url=' + job_url +
'&handleName=' + handleName;
var ifFin = true;
$('#addModal .newParam').each(function(){
ifFin = false;
var key = $(this).find('input[name="key"]').val();
var value = $(this).find('input[name="value"]').val();
if (!key) {
ComAlert.show(2, "新增参数key不可为空");
return;
} else {
if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(key)){
ComAlert.show(2, "新增参数key不合法, 只支持英文字母开头,只含有英文字母、数字和下划线");
return;
$.post(base_url + "/job/add", $("#addModal .form").serialize(), function(data, status) {
if (data.code == "200") {
ComAlert.show(1, "新增调度任务成功", function(){
window.location.reload();
});
} else {
if (data.msg) {
ComAlert.show(2, data.msg);
} else {
ComAlert.show(2, "新增失败");
}
}
paramStr += "&" + key + "=" + value;
ifFin = true;
});
if(ifFin){
$.post(base_url + "/job/add", paramStr, function(data, status) {
if (data.code == "200") {
ComAlert.show(1, "新增调度任务成功", function(){
window.location.reload();
});
} else {
if (data.msg) {
ComAlert.show(2, data.msg);
} else {
ComAlert.show(2, "新增失败");
}
}
});
}
}
});
}
});
$("#addModal").on('hide.bs.modal', function () {
$("#addModal .form")[0].reset()
});
// 新增-添加参数
$("#addModal .addParam").on('click', function () {
var html = '<div class="form-group newParam">'+
'<label for="lastname" class="col-sm-2 control-label">参数&nbsp;<button class="btn btn-danger btn-xs removeParam" type="button">移除</button></label>'+
'<div class="col-sm-4"><input type="text" class="form-control" name="key" placeholder="请输入参数key[将会强转为String]" maxlength="200" /></div>'+
'<div class="col-sm-6"><input type="text" class="form-control" name="value" placeholder="请输入参数value[将会强转为String]" maxlength="200" /></div>'+
'</div>';
$(this).parents('.form-group').parent().append(html);
$("#addModal .removeParam").on('click', function () {
$(this).parents('.form-group').remove();
});
});
// 更新
$(".update").click(function(){
$("#updateModal .form input[name='triggerKeyName']").val($(this).parent('p').attr("name"));
$("#updateModal .form input[name='cronExpression']").val($(this).parent('p').attr("cronExpression"));
$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show');
$("#updateModal .form input[name='jobClassName']").val($(this).parent('p').attr("jobClassName"));
$("#updateModal .form input[name='jobDesc']").val($(this).parent('p').attr("jobDesc"));
$('#updateModal').modal('show');
});
var updateModalValidate = $("#updateModal .form").validate({
errorElement : 'span',
......@@ -231,6 +167,14 @@ $(function() {
cronExpression : {
required : true ,
maxlength: 100
},
jobClassName : {
required : true ,
maxlength: 100
},
jobDesc : {
required : true ,
maxlength: 200
}
},
messages : {
......@@ -242,6 +186,14 @@ $(function() {
cronExpression : {
required :"请输入“任务Corn”." ,
maxlength:"“任务Corn”不应超过100位"
},
jobClassName : {
required :"请输入“任务Impl”." ,
maxlength:"“任务Impl”不应超过100位"
},
jobDesc : {
required :"请输入“任务描述”." ,
maxlength:"“任务描述”不应超过200位"
}
},
highlight : function(element) {
......
package quartz;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.quartz.SchedulerException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.xxl.quartz.DynamicSchedulerUtil;
import com.xxl.service.job.TestDynamicJob;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath*:applicationcontext-*.xml")
public class JunitTest {
@Test
public void getJobKeys() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
List<Map<String, Object>> list = DynamicSchedulerUtil.getJobList();
System.out.println(list);
TimeUnit.SECONDS.sleep(30);
}
@Test
public void addJob() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
Map<String, Object> jobData = new HashMap<String, Object>();
jobData.put(DynamicSchedulerUtil.job_desc, "测试调度03");
boolean ret = DynamicSchedulerUtil.addJob("demo-job04", "0/4 * * * * ?", TestDynamicJob.class, jobData);
System.out.println(ret);
TimeUnit.SECONDS.sleep(3);
}
@Test
public void removeJob() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
boolean ret = DynamicSchedulerUtil.removeJob("demo-job02");
System.out.println(ret);
TimeUnit.SECONDS.sleep(30);
}
@Test
public void rescheduleJob() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
boolean ret = DynamicSchedulerUtil.rescheduleJob("demo-job02", "0/3 * * * * ?");
System.out.println(ret);
TimeUnit.SECONDS.sleep(30);
}
@Test
public void pauseJob() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
boolean ret = DynamicSchedulerUtil.pauseJob("demo-job02");
System.out.println(ret);
TimeUnit.SECONDS.sleep(30);
}
@Test
public void resumeTrigger() throws SchedulerException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, InterruptedException {
boolean ret = DynamicSchedulerUtil.resumeJob("demo-job02");
System.out.println(ret);
TimeUnit.SECONDS.sleep(30);
}
}
package timer.test;
import java.util.Date;
import java.util.Timer;
import org.apache.commons.lang.time.FastDateFormat;
public class TimerTest {
static class DemoTimeTask extends java.util.TimerTask {
public void run() {
System.out.println("run:" + FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss").format(new Date()));
}
}
// ??? 某一个时间段内,重复执行
// runTime:第一次执行时间
// delay: 延迟执行的毫秒数,即在delay毫秒之后第一次执行
// period:重复执行的时间间隔
public static Timer mainTimer;
public static void main(String[] args) {
// 调度器
mainTimer = new Timer();
// Demo任务
DemoTimeTask timeTask = new DemoTimeTask();
System.out.println("now:" + FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss").format(new Date()));
// 1、在特定时间执行任务,只执行一次
//Date runTime = DateUtils.addSeconds(new Date(), 1);
//mainTimer.schedule(timeTask, runTime); // runTime
// 2、在特定时间之后执行任务,只执行一次
//long delay = 1000;
//mainTimer.schedule(timeTask, delay); // delay/ms
// 3、指定第一次执行的时间,然后按照间隔时间,重复执行
//Date firstTime = DateUtils.addSeconds(new Date(), 1);
//long period = 1000;
//mainTimer.schedule(timeTask, firstTime, period); // "period/ms" after "firstTime"
// 4、在特定延迟之后第一次执行,然后按照间隔时间,重复执行
//long delay = 1000;
//long period = 1000;
//mainTimer.schedule(timeTask, delay, period); // "period/ms" after "delay/ms"
// 5、第一次执行之后,特定频率执行,与3同
//Date firstTime = DateUtils.addSeconds(new Date(), 1);
//long period = 1000;
//mainTimer.scheduleAtFixedRate(timeTask, firstTime, period);
// 6、在delay毫秒之后第一次执行,后按照特定频率执行
long delay = 1000;
long period = 1000;
mainTimer.scheduleAtFixedRate(timeTask, delay, period);
/**
* <1>schedule()方法更注重保持间隔时间的稳定:保障每隔period时间可调用一次
* <2>scheduleAtFixedRate()方法更注重保持执行频率的稳定:保障多次调用的频率趋近于period时间,如果任务执行时间大于period,会在任务执行之后马上执行下一次任务
*/
// Timer注销
mainTimer.cancel();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment