jquery easyui datagrid 的问题

菜鸟先飞 2013-08-15 05:30:38
<script type="text/javascript">
$(function() {
$('#tempGrid').datagrid({
fitColumns : true,
url:"getFirmDtlInfo.ht?prmst_id=${prmst_id}",
columns : [ [ {
field : 'item_name',
title : '物资名称',
width : 50,
}, {
field : 'item_desc',
title : '规格型号',
width : 40,
}, {
field : 'pr_qtys',
title : '请购量',
width : 35,
editor : {
type : 'numberbox',
},
} ,] ],

});
});
</script>

<body>
<div id="tempGrid" style="height: 290px">
</body>
这是源码 这个显示的效果如图

我需要的是让表格tempGrid的pr_qtys列成为可编辑列 如图那样
...全文
130 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
菜鸟先飞 2013-08-15
  • 打赏
  • 举报
回复
也就是从一开始都所有行的那一列一直都是可编辑的状态,不是点那一行那一行可编辑
菜鸟先飞 2013-08-15
  • 打赏
  • 举报
回复
引用 4 楼 showbo 的回复:
一般是配置editor,添加onClickRow,然后自行beginEdit方法,直接显示的话只能用html控件,不能使用easyui的。。因为formatter需要返回string,返回dom对象或者easyui的对象都不行 onClickRow: function (rowIndex) { if (lastIndex != rowIndex) { $('#tt').datagrid('endEdit', lastIndex); $('#tt').datagrid('beginEdit', rowIndex); } lastIndex = rowIndex; }
你好 你说的方法和我需要的结果已经很接近了,因为我需要请购量那一列从开始一加载就一直都是编辑状态的 这个在哪里该呢
Go 旅城通票 2013-08-15
  • 打赏
  • 举报
回复
一般是配置editor,添加onClickRow,然后自行beginEdit方法,直接显示的话只能用html控件,不能使用easyui的。。因为formatter需要返回string,返回dom对象或者easyui的对象都不行 onClickRow: function (rowIndex) { if (lastIndex != rowIndex) { $('#tt').datagrid('endEdit', lastIndex); $('#tt').datagrid('beginEdit', rowIndex); } lastIndex = rowIndex; }
菜鸟先飞 2013-08-15
  • 打赏
  • 举报
回复
我是想上面的源码怎么该后显示的效果像这样


引用 1 楼 showbo 的回复:
添加onClickRow:function(rowIndex)执行编辑方法就行
var lastIndex;
//....
onClickRow: function (rowIndex) {
if (lastIndex != rowIndex) {
$('#tt').datagrid('endEdit', lastIndex);
$('#tt').datagrid('beginEdit', rowIndex);
}
lastIndex = rowIndex;
}


如果直接显示输入框,可以使用formatter返回input就行了
{
field : 'pr_qtys',
title : '请购量',
width : 35,
formatter:function(){return '<input type=text/>'}
}


这text可以 但那是我同时后面还有天下combobox的
 {
field : 'back_upb',
title : '资金来源',
width : 40,
editor : {
type : 'combobox',
required : true,
options:{
valueField:'code_no',
textField:'code_name',
url:'${ctx}/pms/op/prMst/codeDtlZjly.ht',
editable:false,
panelHeight : 70,
},


},
}

像我这样写 应该tempGrid的资金来源这一列应该是个下拉列单的可编的 可是页面只显示的是一个valueField的值没有textField还是不可编辑的
呵呵我来啦 2013-08-15
  • 打赏
  • 举报
回复
$('#tempGrid').datagrid('beginEdit'); 就触发了然后编辑,不知道你问的是啥?
Go 旅城通票 2013-08-15
  • 打赏
  • 举报
回复
添加onClickRow:function(rowIndex)执行编辑方法就行
var lastIndex;
//....
onClickRow: function (rowIndex) {
    if (lastIndex != rowIndex) {
        $('#tt').datagrid('endEdit', lastIndex);
        $('#tt').datagrid('beginEdit', rowIndex);
    }
    lastIndex = rowIndex;
}
如果直接显示输入框,可以使用formatter返回input就行了 { field : 'pr_qtys', title : '请购量', width : 35, formatter:function(){return '<input type=text/>'} }

87,909

社区成员

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

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