spreadJs文档(简要记录)

表结构数据属性:

columns = [
	//name:表头数据的枚举属性 displayName:表头的名称 size:列宽 editor:是否可以编辑 headerBgColor:表头颜色  visible:是否隐藏当前栏位
	{ name: '', displayName: '', size: 100, editor: true, headerBgColor: "", visible: false }
];

列表操作事件:

$("#").SpeadJS({
      "bAutoBind": false,
        "bPaginate": false, //是否分页
        "sType": "POST",
        "jColumnCustom": { visible: true, name: "", toBtn: "", sort: true },
        "fnCustomStyle": function(spread, sheet, spreadNS, jColInfos) { //自定义样式
            spread.options.showVerticalScrollbar = true;//是否启用纵向滚动条
            sheet.frozenColumnCount(5); //设置冻结列,冻结列不参与滚动
            sheet.bind(spreadNS.Events.CellClick, function(e, args) {
            sheet.bind(spreadNS.Events.ValidationError, function(e, args) {//单元格校验
            });
            //单元格添加勾选框  -1表示整个列添加
            var checkBox1 = new GC.Spread.Sheets.CellTypes.CheckBox();
            sheet.setCellType(-1, _columnIndex.URGENT_ORDER_EX, checkBox1, GC.Spread.Sheets.SheetArea.viewport);
            sheet.setCellType(-1, _columnIndex.IMPORTANT_ORD_EX, checkBox1, GC.Spread.Sheets.SheetArea.viewport);
    
      // 设置下拉列表
                let aaa= [{ text: "翻新, value: "" }, { text: "", value: "" }, { text: "", value: "" }];
                let bbb = new spreadNS.CellTypes.ComboBox(); 
                bbb.items(aaa).editorValueType(spreadNS.CellTypes.EditorValueType.text); 
                //第一个数据代表处于第几行 ,-1代表全部
                sheet.getRange(-1, index01, -1, 1).cellType(bbb);
 
            //列的编辑开始事件
            sheet.bind(spreadNS.Events.EditStarting, function(e, args) {
            });
            //粘贴事件
            sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, function(s, args) {
            });
            //列的值改变的事件
            sheet.bind(spreadNS.Events.ValueChanged, function(e, args) {
            });

            //Delete键盘删除事件
            sheet.bind(spreadNS.Events.RangeChanged, function(e, args) {
            });
        },
     //数据绑定之前的操作,类似vuedom节点加载前
        "fnBindDataSourceBefore": function (data) {
        },      //单元格点击事件
        "fnButtonClickedCallback": function(row, col, bChecked) {
        }
    });

  

  

原文地址:https://www.cnblogs.com/sixrookie/p/13091690.html