extjs grid 不能选中表格内的文字 我想做一个extjs gridpanel,里边有CheckboxSelectionModel,做好之后发现不能选中复选框。后来发现整个表格内的文字都不能选中。以前做表格的时候都没有遇到这种问题,就做这个表格式出问题了。网上说是css问题,给的解决方案是extjs2。2版本的,我试了一下,不好用。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //重写了Ext.grid.GridView表格的样式,支持选择单元格,便于复制if (!Ext.grid.GridView.prototype.templates) { Ext.grid.GridView.prototype.templates = {};}Ext.grid.GridView.prototype.templates.cell = new Ext.Template( '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} x-selectable {css}" style="{style}" tabIndex="0" {cellAttr}>', '<div class="x-grid3-cell-inner x-grid3-col-{id}" {attr}>{value}</div>', '</td>'); 2.2 的我也用过,勾选checkbox时是可以选中这行的呀。是不是代码有没有问题 var bsm = new Ext.grid.CheckboxSelectionModel(); bacterinrecordqueryGrid = new Ext.grid.GridPanel({ title : '疫苗记录信息', renderTo : 'bgrid', height : '340', store : bacterinrecordqueryStore, // Align:'center', sm : bsm, columns : [bsm, // 自动行号 new Ext.grid.RowNumberer({ header : "序号", width : 40, renderer : function(value, metadata, record, rowIndex) { return bacterinrecordrecord_start + 1 + rowIndex; } }), { header : '编号', dataIndex : 'bacterinrecord.bacterinid', width : 100, // 隐藏列 hidden : true }, { header : '名称', dataIndex : 'bacterinrecord.name', width : 130 }, { header : '数量', dataIndex : 'bacterinrecord.count', width : 100 }, { header : '临界值', dataIndex : 'bacterinrecord.threshold', width : 100 }, { header : '输入代码', dataIndex : 'bacterinrecord.inputcode', width : 100 }, { header : '类型', dataIndex : 'bacterinrecord.bacterintype', width : 100 }, { header : '单位', dataIndex : 'bacterinrecord.bacterinunit', width : 100 }, { header : '属性', dataIndex : 'bacterinrecord.bacterinproperty', width : 100 }, { header : '备注', dataIndex : 'bacterinrecord.re', width : '100%' }], // width : '430', tbar : [{ text : ' 新建 ', tooltip : '新建', iconCls : 'add', handler : function() { bacterinrecordadd(); } }, '-', { text : '修改', tooltip : '修改', iconCls : 'edit', handler : function() { bacterinrecordupdate(); } }, '-', { text : '删除', tooltip : '删除', iconCls : 'del', handler : function() { del(bacterinrecordqueryGrid, bacterinrecordqueryStore, "bacterin/del_Bacterinrecord.action", 'bacterinrecord.bacterinid'); } }], bbar : [{ xtype : 'paging', pageSize : 10, store : bacterinrecordqueryStore, displayInfo : true, beforePageText : "第", afterPageText : "/ {0}页", firstText : "首页", prevText : "上一页", nextText : "下一页", lastText : "尾页", refreshText : "刷新", displayMsg : "当前显示记录从 {0} - {1} 总 {2} 条记录", emptyMsg : "没有相关记录!", doLoad : function(start) { bacterinrecordrecord_start = start; var o = {}, pn = this.paramNames; o[pn.start] = start; this.store.load({ params : o }); } }] }); 1.new Ext.grid.RowNumberer({ header : "序号", width : 40, renderer : function(value, metadata, record, rowIndex) { return bacterinrecordrecord_start + 1 + rowIndex; } }),// 不要这个自动行试试2.dataIndex : 'bacterinrecord.bacterintype',//dataIndex带‘.’还真没试过,为啥要这样用啊。不知道是否是这个原因。改改试试 width=‘100%’写错了,换成width=100 怎样让文字或图片平滑滚动? 函数属性定义为另一个函数 时的疑惑? 如何获得input两个值 页面平滑转换问题 小小鸟的疑惑(js函数理解) 两行代码的问题 请问怎样控制图片可以成比例缩小? 如何知道所选择的文本是否是粗体 二十万火急,我忘了是哪个元素可以实现以下功能了,只用html 求解一个定时器的问题 如何写这个xpath表达式? 怎么得到Struts2标签iterator中的数据呢???
if (!Ext.grid.GridView.prototype.templates) {
Ext.grid.GridView.prototype.templates = {};
}
Ext.grid.GridView.prototype.templates.cell = new Ext.Template(
'<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} x-selectable {css}" style="{style}" tabIndex="0" {cellAttr}>',
'<div class="x-grid3-cell-inner x-grid3-col-{id}" {attr}>{value}</div>',
'</td>'
);
title : '疫苗记录信息',
renderTo : 'bgrid',
height : '340',
store : bacterinrecordqueryStore,
// Align:'center',
sm : bsm,
columns : [bsm,
// 自动行号
new Ext.grid.RowNumberer({
header : "序号",
width : 40,
renderer : function(value, metadata,
record, rowIndex) {
return bacterinrecordrecord_start + 1
+ rowIndex;
}
}), {
header : '编号',
dataIndex : 'bacterinrecord.bacterinid',
width : 100,
// 隐藏列
hidden : true }, {
header : '名称',
dataIndex : 'bacterinrecord.name',
width : 130
}, {
header : '数量',
dataIndex : 'bacterinrecord.count',
width : 100
}, {
header : '临界值',
dataIndex : 'bacterinrecord.threshold',
width : 100
}, {
header : '输入代码',
dataIndex : 'bacterinrecord.inputcode',
width : 100
}, {
header : '类型',
dataIndex : 'bacterinrecord.bacterintype',
width : 100
}, {
header : '单位',
dataIndex : 'bacterinrecord.bacterinunit',
width : 100
}, {
header : '属性',
dataIndex : 'bacterinrecord.bacterinproperty',
width : 100
}, {
header : '备注',
dataIndex : 'bacterinrecord.re',
width : '100%'
}],
// width : '430',
tbar : [{
text : ' 新建 ',
tooltip : '新建',
iconCls : 'add',
handler : function() {
bacterinrecordadd();
}
}, '-', {
text : '修改',
tooltip : '修改',
iconCls : 'edit',
handler : function() {
bacterinrecordupdate();
}
}, '-', {
text : '删除',
tooltip : '删除',
iconCls : 'del',
handler : function() {
del(bacterinrecordqueryGrid,
bacterinrecordqueryStore,
"bacterin/del_Bacterinrecord.action",
'bacterinrecord.bacterinid');
}
}],
bbar : [{
xtype : 'paging',
pageSize : 10,
store : bacterinrecordqueryStore,
displayInfo : true,
beforePageText : "第",
afterPageText : "/ {0}页",
firstText : "首页",
prevText : "上一页",
nextText : "下一页",
lastText : "尾页",
refreshText : "刷新",
displayMsg : "当前显示记录从 {0} - {1} 总 {2} 条记录",
emptyMsg : "没有相关记录!",
doLoad : function(start) {
bacterinrecordrecord_start = start;
var o = {}, pn = this.paramNames;
o[pn.start] = start; this.store.load({
params : o
}); } }]
});
header : "序号",
width : 40,
renderer : function(value, metadata,
record, rowIndex) {
return bacterinrecordrecord_start + 1
+ rowIndex;
}
}),// 不要这个自动行试试
2.dataIndex : 'bacterinrecord.bacterintype',//dataIndex带‘.’还真没试过,为啥要这样用啊。不知道是否是这个原因。改改试试