冻结单元格

var
//自动创建数据
myData = Handsontable.helper.createSpreadsheetData(100, 50),
container = document.getElementById('example1'),
positions = document.getElementById('positions'),
hot; hot = new Handsontable(container, {
data: myData,
colWidths: [47, 47, 47, 47, 47, 47, 47, 47, 47, 47],
//显示行头和列头
rowHeaders: true,
colHeaders: true,
   //冻结单元格
fixedRowsTop: 2,
fixedColumnsLeft: 2
}); setInterval(function () {
var str = '';
   //获得可见首行的序号
str += 'RowOffset: ' + hot.rowOffset(); positions.innerHTML = str;
}, 100);

手动调整行列大小

 var
container = document.getElementById('example1'),
hot; hot = new Handsontable(container, {
data: Handsontable.helper.createSpreadsheetData(200, 10),
rowHeaders: true,
colHeaders: true,
   //设置列的宽度
colWidths: [55, 80, 80, 80, 80, 80, 80],
//设置行的宽度,第四行是默认的
rowHeights: [50, 40, 100],
//手动调整列的宽度
manualColumnResize: true,
manualRowResize: true
});

滚动行列

http://docs.handsontable.com/0.16.0/demo-scrollbars.html

列的扩展

 var
container1 = document.getElementById('example1'),
hot1; hot1 = new Handsontable(container1, {
data: Handsontable.helper.createSpreadsheetData(40, 6),
colWidths: 47,
rowHeaders: true,
colHeaders: true,
  //扩展最后一列,其他列的宽度是47
stretchH: 'last',
//把table的宽度设为容器的宽度,列平分宽度
   stretchH: 'all',
  //默认值
  stretchH: 'none',
  //右键可用,默认为undefined
contextMenu: true
});

列的冻结:需要开启contextMenu

var
myData = Handsontable.helper.createSpreadsheetData(200, 100),
container = document.getElementById('example1'),
hot; hot = new Handsontable(container, {
data: myData,
rowHeaders: true,
colHeaders: true,
fixedColumnsLeft: 2,
contextMenu: true,
  //列的手动冻结
manualColumnFreeze: true
});

行列的移动:列头左侧,行头上侧

 var
example1 = document.getElementById('example1'),
hot; hot = new Handsontable(example1, {
data: Handsontable.helper.createSpreadsheetData(200, 20),
rowHeaders: true,
colHeaders: true,
manualColumnMove: true,
manualRowMove: true
});

当前元素高亮

 var
data = [
['', 'Kia', 'Nissan', 'Toyota', 'Honda'],
['2013', 10, 11, 12, 13],
['2014', 20, 11, 14, 13],
['2015', 30, 15, 12, 13]
],
container = document.getElementById('example1'),
hot; hot = Handsontable(container, {
data: data,
minRows: 5,
minCols: 6,
  //指定当前行的名字
currentRowClassName: 'currentRow',
  //指定当前列的名字
currentColClassName: 'currentCol',
rowHeaders: true,
colHeaders: true
});
//选择元素
hot.selectCell(2,2);

分组:也可以设置groups:true,但是这种方式没有涉及到细节

 var
example1 = document.getElementById('example1'),
settings,
hot; settings = {
data: Handsontable.helper.createSpreadsheetData(200, 20),
rowHeaders: true,
colHeaders: true,
groups: [
{
cols: [0, 2]
},
{
cols: [3, 7]
},
{
cols: [5, 7]
},
{
rows: [0, 4]
},
{
rows: [5, 7]
},
{
rows: [2, 4]
}
]
};
hot = new Handsontable(example1, settings);

Pre-populating new rows 

Sorting data

可以使用array.prototype.sort(),排好序之后,在render(),不过这样会改变数据源的结构。如果想保持数据源不被破坏,需要使用如下方法:

columnSorting为true,表示可以排序,但是还没排好序

columnSorting为object,配置一些参数

检查是否开启排序

hot.sortingEnabled ? doSomething() : doSomethingElse();

是否排好序

return hotInstance.sortingEnabled && typeof hotInstance.sortColumn !== 'undefined';
//sortOrder is true, then the order is ascending, otherwise, the order is descending.

排序的三种方法

1、columnSorting
2、点击表头:最常用
3、调用sort():如果开启了columnSorting,则可以使用sort(0, false)方法

 

Pagination 

http://docs.handsontable.com/0.16.0/demo-pagination.html#3

 

 

 

  

  

handsontable-常用配置的更多相关文章

  1. logback 常用配置详解<appender>

    logback 常用配置详解 <appender> <appender>: <appender>是<configuration>的子节点,是负责写日志的 ...

  2. 【转】logback logback.xml常用配置详解(三) <filter>

    原创文章,转载请指明出处:http://aub.iteye.com/blog/1110008, 尊重他人即尊重自己 详细整理了logback常用配置, 不是官网手册的翻译版,而是使用总结,旨在更快更透 ...

  3. 【转】logback logback.xml常用配置详解(二)<appender>

    原创文章,转载请指明出处:http://aub.iteye.com/blog/1101260, 尊重他人即尊重自己 详细整理了logback常用配置, 不是官网手册的翻译版,而是使用总结,旨在更快更透 ...

  4. 【转】logback logback.xml常用配置详解(一)<configuration> and <logger>

    原创文章,转载请指明出处:http://aub.iteye.com/blog/1101260, 尊重他人即尊重自己 详细整理了logback常用配置, 不是官网手册的翻译版,而是使用总结,旨在更快更透 ...

  5. 【转】logback 常用配置详解(序)logback 简介

    原创文章,转载请指明出处:http://aub.iteye.com/blog/1101222, 尊重他人即尊重自己 详细整理了logback常用配置, 不是官网手册的翻译版,而是使用总结,旨在更快更透 ...

  6. logback 常用配置详解(二) <appender>

    logback 常用配置详解(二) <appender> <appender>: <appender>是<configuration>的子节点,是负责写 ...

  7. SpringBoot常用配置简介

    SpringBoot常用配置简介 1. SpringBoot中几个常用的配置的简单介绍 一个简单的Spring.factories # Bootstrap components org.springf ...

  8. .net学习笔记----WebConfig常用配置节点介绍

    一.配置文件入门 .Net提供了一种保存项目配置信息的办法,就是利用配置文件,配置文件的后缀一般是.config.在WinForm程序中配置文件一般是App.config.在Asp.net中一般默认是 ...

  9. logback logback.xml常用配置详解(三)

    logback logback.xml常用配置详解 <filter> <filter>: 过滤器,执行一个过滤器会有返回个枚举值,即DENY,NEUTRAL,ACCEPT其中之 ...

  10. JVM 常用配置

    JVM的配置,最常用的两个配置就是:-Xms512m –Xmx1024m -Xms设置JVM的初始化内存大小,-Xmx为最大内存大小,当突破这个值,将会报内存溢出,导致的原因有很多,主要是虚拟机的回收 ...

随机推荐

  1. 跟着TensorFlow的进阶级教程实现MNIST库的训练

    转载出处:http://blog.csdn.net/feifei884431/article/details/51429829 背景介绍 代码实现及结果 小问题  ResourceExhaustedE ...

  2. java web 程序---javabean实例--登陆界面并显示用户名和密码

    重点:注意大小写,不注意细节,这点小事,还需要请教 发现一个问题,也是老师当时写的时候,发现代码没错,但是就是运行问题. 大家看,那个java类,我们要求是所有属性均为私有变量,但是方法为公有的,如果 ...

  3. PAT 甲级 1011 World Cup Betting (20)(20 分)(水题,不用特别在乎精度)

    1011 World Cup Betting (20)(20 分) With the 2010 FIFA World Cup running, football fans the world over ...

  4. 【ZZ】Web开发的入门指导 | 菜鸟教程

    Web开发的入门指导 http://www.runoob.com/w3cnote/a-beginners-guide-to-web-development.html

  5. Bootstrap的介绍和响应式媒体查询

    Bootstrap的介绍 凡是使用过Bootstrap的开发者,都不在乎做这么两件事情:复制and粘贴.哈哈~,是的使用Bootstrap非常简单,但是在复制粘贴之前,需要先对Bootstrap的用法 ...

  6. vuex语法精简(方便开发查阅)

    vuex语法精简(方便开发查阅) store结构 state Getter Mutation actions vuex语法精简(方便开发查阅) 本文只是方便开发的时候快速查阅到相关语法,想看详细内容请 ...

  7. java JDBC数据库连接操作

    import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public clas ...

  8. 通过nginx + lua来统计nginx上的监控网络请求和性能

    介绍 以前我们为nginx做统计,都是通过对日志的分析来完成.比较麻烦,现在基于ngx_lua插件,开发了实时统计站点状态的脚本,解放生产力. 项目主页: https://github.com/sky ...

  9. 第6章 数组、指针与字符串(一)基于范围的for循环

  10. iOS下nil 、NULL、 Nil 、NSNull的区别

    1.nil,定义一个空的实例,指向OC中对象的空指针. 示例代码: NSString *someString = nil; NSURL *someURL = nil; id someObject = ...