日期:2014-05-16  浏览次数:20357 次

jquery easyui datagrid 的问题
<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列成为可编辑列 如图那样
easyui jQuery datagrid

------解决方案--------------------
添加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/>'}
}

------解决方案--------------------
$('#tempGrid').datagrid('beginEdit'); 就触发了然后编辑,不知道你问的是啥?