冻结单元格

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. pycharm修改代码模板支持中文输出

    python2.x默认不支持中文输出,需要在py的开头添加 #coding: utf- 在pycharm里面,选项,editor,file and code templates,选择python sc ...

  2. Train-Alypay-Cloud:分布式微服务中间件sofa 开发培训(第二次)

    ylbtech-Train-Alypay-Cloud:分布式微服务中间件sofa 开发培训(第二次) 1.返回顶部 1. 这是本次培训的内容,望各位提前配好环境.工具.2.6-2.7 我们在环球金融8 ...

  3. 微信小程序从子页面退回父页面时的数据传递 wx.navigateBack()

    我们知道,在微信小程序中,从一个页面转到另一个页面,一般情况下可以通过navigate或redirect时候的url来携带参数,然后在目标页面的onLoad函数参数中获取这些url参数.例如: // ...

  4. Eclipse Android 代码自动提示功能 +导入 epf

    1.设置 java 文件的代码提示功能 打 开 Eclipse 依次选择 Window > Preferences > Java > Editor - Content Assist ...

  5. android studio 3.0.1使用笔记(二)

    发布前如何生成正式签名的APK? 一,查看APK签名方法:??Preferences->Android->Build可以查看到这个默认keystore文件的位置. 二,新建正式签名过程: ...

  6. CentOS 环境下基于 Nginx uwsgi 搭建 Django 站点

    因为我的个人网站 restran.net 已经启用,博客园的内容已经不再更新.请访问我的个人网站获取这篇文章的最新内容,CentOS 环境下基于 Nginx uwsgi 搭建 Django 站点 以下 ...

  7. Gitlab 社区版安装部署和维护指南

    因为我的个人网站 restran.net 已经启用,博客园的内容已经不再更新.这篇文章是在 Gitlab 7.4 的环境下配置的,相关内容可能已经过时. 后续做了一次迁移,将 Gitlab 升级到了 ...

  8. SQL中INNER JOIN的用法

    SQL join 用于根据两个或多个表中的列之间的关系,从这些表中查询数据. Join 和 Key 有时为了得到完整的结果,我们需要从两个或更多的表中获取结果.我们就需要执行 join. 数据库中的表 ...

  9. selenium webdriver——XPath 定位

    baidu.html代码如下 ....<form id="form" class="fm" action="/s" name=&quo ...

  10. Eclipse使用xdoclet1.2.3 生成hibernate配置文件和映射文件

    用ant和xdoclet生成hibernate配置文件可以为我们省去很多配置的操作,废话不多说,直接给栗子: 测试环境: eclipse:Eclipse Java EE IDE for Web Dev ...