<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列成为可编辑列 如图那样
easyuijQuerydatagrid

解决方案 »

  1.   

    添加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/>'}
    }
      

  2.   

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

  3.   

    我是想上面的源码怎么该后显示的效果像这样这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还是不可编辑的
      

  4.   

    一般是配置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;
    }