表格
srczh.js中的表格允许动态构建、数据绑定、类型自定义等。
要使用srczh.js中的表格功能,请在页面中引入srczh.table.js。
项目地址
https://srczh.com/src/soft/srczh_table
参数定义
src_table |
id/class | * | id或class创建对象 |
thead | 表格头 | 允许直接定义表头 |
tbody | 表数据 | 允许直接定义表数据 |
notd | true,false | 表行编号 |
mvtd | true,false | 表列位置移动(使用鼠标中键按住拖到需要移动列位) |
cgtd | true,false | 表列隐藏 |
edtd | true,false | 表格编辑 |
rstb | true,false | 表格缩放 |
scroll | true,false | 表格滚动 |
oveds | true,false | 预留空行 |
tdw | true,false | 指定列宽度 |
tdsize | tbl-1,tbl-2 | 表行高度 |
动态构建
//通过定义thead和tbody创建src-table
var tjson ={
id : 'qxtablet',
thead :[ '测试','发现','开始','准备','接续','触发','结束' ],
tbody:[[['测试1','发现2','开始3','准备4','接续5','触发6','结束7']],[['a', 'b','c','d','e','f','g']],[["1","2","3","4","5","6","7"]]],
notd:true,//表格编号
mvtd:true,//表格列移动
pxtd:true,//列排序
// cltd:true,//列锁定
cgtd:true, //列可以隐藏
edtd:true,//表格编辑
rstb:true,//表格大小缩放
// scroll:true, //滚动条
oveds:true, //预留空行
//tdw:["30%","10%","10%","10%","20%","10%","10%"]
};
new src_table(tjson);
表格生成
id | 名称 | 邮箱 |
1 | admin | admin@srczh.com |
2 | public | public@srczh.com |
3 | zjun | zjun@srczh.com |
//直接通过表格反转为src-table
var tjson ={
id : 'tablet',
notd:true,//表格编号
mvtd:true,//表格列移动
pxtd:true,//列排序
cltd:true,//列锁定
cgtd:true, //列可以隐藏
edtd:true,//表格编辑
rstb:true,//表格大小缩放
scroll:true, //滚动条
oveds:true, //预留空行
tdw:["10%","10%","40%"]
};
new src_table(tjson);
id | 名称 | 邮箱 |
1 | admin | admin@srczh.com |
2 | public | public@srczh.com |
3 | zjun | zjun@srczh.com |
树状表格
名称 | 描述 |
Html | Html文档元素 |
文本框 | 文本输入框 |
选择框 | 下拉选择窗 |
列表 | 多选选择列表 |
var json ={
id : 'templtables',
notd:true,//表格编号
mvtd:true,//表格列移动
tree:true,
cgtd:true,//列隐藏
pxtd:true,//列排序
cltd:false,//列锁定
// edtd:false,//表格编辑
rstb:false,//表格大小
style :'eclipse',
tdw:["20%","50%",]
};
new src_table(json);
名称 | 描述 |
Html | Html文档元素 |
文本框 | 文本输入框 |
选择框 | 下拉选择窗 |
列表 | 多选选择列表 |