包含checkbox、复合表头、多行可编辑单元格、combobox单元格,就差上次做的table中每行中的关联检索combobox单元格了。
目前已修改为单行编辑,多行编辑时的check有问题
$("#add").click(function(){
var index=$('#dataGrid').datagrid('appendRow', {
FlowTypeName: 'new name',
FlowTypeCode: 30
}).datagrid('getRows').length-1;
$('#dataGrid').datagrid('beginEdit',index);
});
$(function () {
var datagrid;
var status = { "statusResult": [
{ "statusKey": "ALL", "statusVaule":"全部" },
{ "statusKey": "70", "statusVaule":"已开入WA提单" },
{ "statusKey": "80", "statusVaule":"已入WA库" }]};
console.info(status.statusResult);
datagrid = $('#dataGrid').datagrid({
url: "/purchase/findPredictingStockDetailList.html",
fit: true,
fitColumns: false,
toolbar: $('#tb'),
singleSelect: true,
nowrap: true,
rownumbers: true,
singleSelect: false,
selectOnCheck: true,
checkOnSelect: true,
onClickCell: function(index,field,value){
$(this).datagrid('beginEdit', index);
var ed = $(this).datagrid('getEditor', {index:index,field:field});
$(ed.target).focus();
// $(ed).blur(function(){
// alert(1111111111111111);
// $(this).datagrid('endEdit', index);
// });
},
queryParams: {
report_year_week: "$!report_year_week"
},
columns: [
[
{field:'check',title:'选择',width:40,align:'center', rowspan:2,
checkbox:true
},
{field:'aa',title:'启用',width:60,align:'center', rowspan:2
},
{title:'判断方式',align:'center',colspan:2},
{title:'关闸方式',align:'center',colspan:5},
{field:'aaa',title:'说明',width:300,align:'left', rowspan:2
},
],[
{field:'projectID',
title:'渠道',
width:100,
editor:{
type:'combobox',
options:{
data:status.statusResult,
valueField:'statusKey',
textField:'statusVaule',
panelHeight:'auto',
editable:false,
onSelect:function(record){
}
}
}
},
{field: 'FlowTypeCode', title: '超期库龄', width: 80, align: 'right',
editor: {
type: 'text',
options: { required: true }
}
},
{field:'col4',title:'渠道',width:100,rowspan:1},
{field:'name1',title:'品牌',width:100,rowspan:1},
{field:'addr1',title:'品类',width:100,rowspan:1},
{field:'col41',title:'型号',width:100,rowspan:1},
{field:'ss',title:'库位',width:100,rowspan:1}
]
]
});
$('#dataGrid').parent().find("div .datagrid-header-check").children("input[type='checkbox']").eq(0).attr("checked", false);
});