dhtmlx使用翻译(八)dhtmlxgrid 保存数据操作 使用后记
2010-07-01 12:20
357 查看
1.1.160 enableMathSerialization (mode)
版本:专业版 需要dhtmlxgrid_math.js支持
参数:
mode:true/false
用途:设置运算公式序列化
参考实例:
mygrid.enableMathSerialization(true);
1.1.161 serialize
版本:专业版
参数:
用途:返回构建当前grid的xml数据字符串
参考实例:
var str=mygrid.serialize();
1.1.162 serializeToCSV (textmode)
版本:专业版 需要dhtmlxgrid_nxml.js支持
参数:
textmode:true/false
用途:返回构建当前grid的csv数据
参考实例:
var csv=mygrid.serializeToCSV();
//只有text内容被序列化,忽略html元素
var csv=mygrid.serializeToCSV(true);
1.1.163 setFieldNam (mask)
暂时没用到
1.1.164 setSerializableColumns (list)
版本:专业版
参数:
list:是否序列化当前列
用途:设置grid各列是否序列化
参考实例:
mygrid.setSerializableColumns("true,false,false,true,false,false,false");
1.1.165 setSerializationLevel (userData, selectedAttr, config, changedAttr, onlyChanged, asCDATA)
版本:专业版
参数:
userData:true/false 是否使用当前数据序列化
selectedAttr:true/false 在被选中的xml节点中包含selected属性标识被选中
如<row id="null" selected="1">
config:true/false 是否包含<head>节点,罗列各列配置信息
changedAttr:true/false 是否修改的单元格中,在<cell>节点中包含是否修改属性
onlyChanged:true/false 是否仅包含修改过的row节点
asCDATA:true/false 是否使用CDATA格式,避免无效字符
用途:设置grid序列化配置
参考实例:
mygrid.setSerializationLevel(true,true,false,true,false,true);
1.3 个人使用后记
使用发现bug修改记录:
1.在dhtmlxgrid.js中有这么一句:
var imUrl=label.replace(/.*/[([^>]+)/]/,"$1");
真确应该写为:var imUrl=label.replace(/.*/[([^>]+)/].*/,"$1");不然没法子替换]With Icon后的字符串。即image的路径就不对了。
2. 注意在2.5版本中 dhtmlxgrid.js 中503行处
var next=Math.max((this._drsclmW ? this._drsclmW[fcols[i]]: 0),ms); 这里没有增加对this._drsclmW[fcols[i]]是否可用校验。
应改为:
var next=Math.max((this._drsclmW ? (this._drsclmW[fcols[i]]? this._drsclmW[fcols[i]]:0) : 0),ms);
3.由于parse采用的是同步加载数据的模式,所以可以自行扩展支持当前grid加载完毕后相应处理函数,不过实际上parse也提供回调函数接口
4 虽然grid提供了丰富的列格式定义,但这里可以自行定义,主要是修改dhtmlxgridcell.js即可。给个参考,新增一个带下划线的格式edu,这样可以配合onRowSelect事件实现单元值下划线连接方式
在dhtmlxgridcell.js中新增如下:
function eXcell_edu(cell) {
if (cell) {
this.cell = cell;
this.grid = this.cell.parentNode.grid;
}
this.getValue = function () {
if ((this.cell.firstChild) && ((this.cell.atag) && (this.cell.firstChild.tagName == this.cell.atag))) {
return this.cell.firstChild.value;
}
if (this.cell._clearCell) {
return "";
}
return (_isIE ? this.cell.innerText : this.cell.textContent);
};
this.setValue = function (val) {
if (!val || val.toString()._dhx_trim() == "") {
val = " ";
this.cell._clearCell = true;
} else {
this.cell._clearCell = false;
}
this.setLabel("<u style='cursor=hand'>" + val + "</u>");
};
}
eXcell_edu.prototype = new eXcell_ed;
5 对于需要隐藏的数据列,也可以采用定义列宽为0的方式
6 getRowId(ind),如果数据没有指定id值,则返回 id = 当前行索引+1;
(注:本人文章均为原创,转载请注明出处!20100630写于深圳。)
版本:专业版 需要dhtmlxgrid_math.js支持
参数:
mode:true/false
用途:设置运算公式序列化
参考实例:
mygrid.enableMathSerialization(true);
1.1.161 serialize
版本:专业版
参数:
用途:返回构建当前grid的xml数据字符串
参考实例:
var str=mygrid.serialize();
1.1.162 serializeToCSV (textmode)
版本:专业版 需要dhtmlxgrid_nxml.js支持
参数:
textmode:true/false
用途:返回构建当前grid的csv数据
参考实例:
var csv=mygrid.serializeToCSV();
//只有text内容被序列化,忽略html元素
var csv=mygrid.serializeToCSV(true);
1.1.163 setFieldNam (mask)
暂时没用到
1.1.164 setSerializableColumns (list)
版本:专业版
参数:
list:是否序列化当前列
用途:设置grid各列是否序列化
参考实例:
mygrid.setSerializableColumns("true,false,false,true,false,false,false");
1.1.165 setSerializationLevel (userData, selectedAttr, config, changedAttr, onlyChanged, asCDATA)
版本:专业版
参数:
userData:true/false 是否使用当前数据序列化
selectedAttr:true/false 在被选中的xml节点中包含selected属性标识被选中
如<row id="null" selected="1">
config:true/false 是否包含<head>节点,罗列各列配置信息
changedAttr:true/false 是否修改的单元格中,在<cell>节点中包含是否修改属性
onlyChanged:true/false 是否仅包含修改过的row节点
asCDATA:true/false 是否使用CDATA格式,避免无效字符
用途:设置grid序列化配置
参考实例:
mygrid.setSerializationLevel(true,true,false,true,false,true);
1.3 个人使用后记
使用发现bug修改记录:
1.在dhtmlxgrid.js中有这么一句:
var imUrl=label.replace(/.*/[([^>]+)/]/,"$1");
真确应该写为:var imUrl=label.replace(/.*/[([^>]+)/].*/,"$1");不然没法子替换]With Icon后的字符串。即image的路径就不对了。
2. 注意在2.5版本中 dhtmlxgrid.js 中503行处
var next=Math.max((this._drsclmW ? this._drsclmW[fcols[i]]: 0),ms); 这里没有增加对this._drsclmW[fcols[i]]是否可用校验。
应改为:
var next=Math.max((this._drsclmW ? (this._drsclmW[fcols[i]]? this._drsclmW[fcols[i]]:0) : 0),ms);
3.由于parse采用的是同步加载数据的模式,所以可以自行扩展支持当前grid加载完毕后相应处理函数,不过实际上parse也提供回调函数接口
4 虽然grid提供了丰富的列格式定义,但这里可以自行定义,主要是修改dhtmlxgridcell.js即可。给个参考,新增一个带下划线的格式edu,这样可以配合onRowSelect事件实现单元值下划线连接方式
在dhtmlxgridcell.js中新增如下:
function eXcell_edu(cell) {
if (cell) {
this.cell = cell;
this.grid = this.cell.parentNode.grid;
}
this.getValue = function () {
if ((this.cell.firstChild) && ((this.cell.atag) && (this.cell.firstChild.tagName == this.cell.atag))) {
return this.cell.firstChild.value;
}
if (this.cell._clearCell) {
return "";
}
return (_isIE ? this.cell.innerText : this.cell.textContent);
};
this.setValue = function (val) {
if (!val || val.toString()._dhx_trim() == "") {
val = " ";
this.cell._clearCell = true;
} else {
this.cell._clearCell = false;
}
this.setLabel("<u style='cursor=hand'>" + val + "</u>");
};
}
eXcell_edu.prototype = new eXcell_ed;
5 对于需要隐藏的数据列,也可以采用定义列宽为0的方式
6 getRowId(ind),如果数据没有指定id值,则返回 id = 当前行索引+1;
(注:本人文章均为原创,转载请注明出处!20100630写于深圳。)
相关文章推荐
- dhtmlx使用翻译(六)dhtmlxgrid 单元格操作
- dhtmlx使用翻译(三)dhtmlxgrid 数据加载部分
- dhtmlx使用翻译(四)dhtmlxgrid 行操作
- dhtmlx使用翻译(五)dhtmlxgrid 列操作
- dhtmlx使用翻译(七)dhtmlxgrid 选择/过滤操作
- DhtmlxGrid组件应用---结合Ajax实现对表格数据的无刷新操作
- android使用sharepreference保存用户操作数据
- [翻译] Scott Mitchell 的ASP.NET 2.0数据操作教程之八:使用两个DropDownList过滤的主/从报表
- 无废话Android之android下junit测试框架配置、保存文件到手机内存、android下文件访问的权限、保存文件到SD卡、获取SD卡大小、使用SharedPreferences进行数据存储、使用Pull解析器操作XML文件、android下操作sqlite数据库和事务(2)
- PB Grid风格的数据窗口怎么保存用户使用时设定的列的宽度、列的位置等信息
- 使用Ext.grid.column.Action操作表格数据
- Android开发-使用SharedPreferences保存数据-常用操作
- [翻译] Scott Mitchell 的ASP.NET 2.0数据操作教程之十:使用 GridView 和DetailView实现的主/从报表
- 数据库操作_连接SQL Server数据库示例;连接ACCESS数据库;连接到 Oracle 数据库示例;SqlCommand 执行SQL命令示例;SqlDataReader 读取数据示例;使用DataAdapter填充数据到DataSet;使用DataTable存储数据库表;将数据库数据填充到 XML 文件;10 使用带输入参数的存储过程;11 使用带输入、输出参数的存储过程示;12 获得数据库中表的数目和名称;13 保存图片到SQL Server数据库示例;14 获得插入记录标识号;Exce
- 【android, 3】3.操作数据保存到rom,sd卡上,sharedpreference的使用,pul解析xml
- [翻译] Scott Mitchell 的ASP.NET 2.0数据操作教程之七:使用DropDownList过滤的主/从报表
- android使用sharepreference保存用户操作数据
- [翻译] Scott Mitchell 的ASP.NET 2.0数据操作教程之七:使用DropDownList过滤的主/从报表
- dhtmlx使用翻译(二) dhtmlxgrid 配置部分
- dhtmlx使用翻译(一)dhtmlxgrid 配置部分