冻结单元格

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. php7新特性一览

    1.太空船操作符 用于比较2个表达式,例如当\(a小于,等于或大于\)b时,分别返回-1,0,1 php echo 1 <=> 1; //0 echo PHP_EOL; echo 1 &l ...

  2. 总是有人问我,那你能造出你自己都搬不动的石头吗? 我说不能,但我能写出个我自己都无法 fix 的 bug。

    总是有人问我,那你能造出你自己都搬不动的石头吗? 我说不能,但我能写出个我自己都无法 fix 的 bug.

  3. bzoj 3965: [WF2011]Pyramids

    Description 如果你有足够的石块,那么建一座金字塔绝不算难事.举个例子,在一块平地上,我们铺一个10*10的矩形,然后在10*10的矩形上面铺一个9*9的,然后8*8的……以此类推,直到顶上 ...

  4. bs的过滤器功能例子

    第一步 #src链接要符合下面要求,这里返回是 false or true def valid_img(src): return src.endswith('jpg') and 'img.jandan ...

  5. @JsonIgnore的源码说明

    @JsonIgnore不仅仅是在getter上有影响,也对setter方法有影响: 所在包:com.fasterxml.jackson.annotation; 源码: import java.lang ...

  6. SpringBoot Session 管理及集群管理

    1.配置session的超时时间 : 在application.prooperties中 server.session.timeout = 600       //以秒为单位,默认最少一分钟 2.配置 ...

  7. segment_object_model_3d

    * *********************************************************************** * This example program sho ...

  8. Information Retrieval II

    [Information Retrieval II] 搜索引擎分类: 1.目录式搜索引擎. 2.全文搜索引擎. 3.元搜索引擎(Meta-Search Engine). 搜索引擎的4个阶段:下载(cr ...

  9. unity5-GI是什么?

    GI是什么? GI =直接光照+间接光照+环境光+反射光.直接光照先不用说了,间接光照是光线在物体上反射所带来的光照. 核心参数: 每个光源上的Bounce Intensity.环境光可以直接理解为你 ...

  10. Linux主流发行版本

    一.简介 而工欲善其事,必先利其器,Linux的世界相當廣大,除了最著名的Ubuntu以外還有不少發行版.然文人相輕,自古皆然,了解不同發行版的優勢不只嘴上攻防用的上,也是學Linux一個有趣的地方! ...