extjs grid 不能选中表格内的文字

跑跑鱼 2010-08-28 09:55:37
我想做一个extjs gridpanel,里边有CheckboxSelectionModel,做好之后发现不能选中复选框。后来发现整个表格内的文字都不能选中。以前做表格的时候都没有遇到这种问题,就做这个表格式出问题了。网上说是css问题,给的解决方案是extjs2。2版本的,我试了一下,不好用。
...全文
541 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
跑跑鱼 2010-08-29
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 xiaoyi_nuo 的回复:]
width=‘100%’写错了,换成width=100
[/Quote]
确实是这儿错了。

我最初的意思是 固定前边列的宽度,最后一列为剩下宽度的100%,显示效果跟预期的一样。只是没想到出现不能选 这样的问题。
跑跑鱼 2010-08-29
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 xiaoyi_nuo 的回复:]
width=100
[/Quote]?
xiaoyi_nuo 2010-08-29
  • 打赏
  • 举报
回复
width=‘100%’写错了,换成width=100
xiaoyi_nuo 2010-08-29
  • 打赏
  • 举报
回复
width=100
zoujp_xyz 2010-08-29
  • 打赏
  • 举报
回复
1.new Ext.grid.RowNumberer({
header : "序号",
width : 40,
renderer : function(value, metadata,
record, rowIndex) {
return bacterinrecordrecord_start + 1
+ rowIndex;
}
}),// 不要这个自动行试试
2.dataIndex : 'bacterinrecord.bacterintype',//dataIndex带‘.’还真没试过,为啥要这样用啊。不知道是否是这个原因。改改试试
zoujp_xyz 2010-08-28
  • 打赏
  • 举报
回复
2.2 的我也用过,勾选checkbox时是可以选中这行的呀。是不是代码有没有问题
hoojo 2010-08-28
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 xiaojing7 的回复:]
JScript code
//重写了Ext.grid.GridView表格的样式,支持选择单元格,便于复制
if (!Ext.grid.GridView.prototype.templates) {
Ext.grid.GridView.prototype.templates = {};
}
Ext.grid.GridView.prototype.templates.cell = ……
[/Quote]
+
xiaojing7 2010-08-28
  • 打赏
  • 举报
回复
//重写了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>'
);
hnwlh 2010-08-28
  • 打赏
  • 举报
回复
不是在定义表格的时候可以选择定义成可编辑模式的吗?
跑跑鱼 2010-08-28
  • 打赏
  • 举报
回复
复选框 不能选啊。
2楼的意思是把 你给的代码直接放进js代码中吗?我直接放进去了,可是还是不好用
跑跑鱼 2010-08-28
  • 打赏
  • 举报
回复
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.remark',
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
});

}

}]
});
zoujp_xyz 2010-08-28
  • 打赏
  • 举报
回复
3.1的也没有问题啊。看看你写的代码
跑跑鱼 2010-08-28
  • 打赏
  • 举报
回复
我用的是3.1,楼上给的解决方案是2.2的吧。

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧