var diverType = { Rows: [{ "int_value": 1, "str_value": "少发(-)" }, { "int_value": 2, "str_value": "破损(-)"},{ "int_value": 3, "str_value": "生锈(-)" }],Total: 3 }; var diverTypeList = diverType.Rows;
{ display: '差异类型', name: 'diver_type', width: 100, type: 'float',editor: { type: 'select', data: diverTypeList, valueField: 'diver_type', textField: 'str_value'}, render:function(record,rowindex,value,column) { for(var i=0;i<diverTypeList.length;i++) { if(parseFloat(record.allocatedqty) == parseFloat(record.delivery_num)) { return ""; } else { return diverTypeList[i]["str_value"]; } } } }
function f_onBeforeEdit(e) { if(e.column.columnname=="diver_type") { if(parseFloat(e.record.allocatedqty) == parseFloat(e.record.delivery_num)) { return false; } else { return true; } } }
======================================================================================================================================
//下拉列表json var dcrType = { Rows: [{ "dcr_type": 1, "str_value": "少发(-)" }, { "dcr_type": 2, "str_value": "错发(-)"},{ "dcr_type": 3, "str_value": "破损(0)" }, { "dcr_type": 4, "str_value": "生锈(0)"},{ "dcr_type": 5, "str_value": "多发(+)" }],Total: 5 };
var dcrTypeList = dcrType.Rows;
{ display: '差异类型', name: 'dcr_type', width: 80,isSort:false, editor: { type: 'select', data: dcrTypeList, valueField: 'dcr_type', textField: 'str_value' }, render: function (record, rowindex,value,column) { if(record.vips_qty*1 ==record.available_Stock_Qty*1) { column.editor=false; } else { if(record.dcr_qty!="0.00" || record.dcr_qty !="0") { column.editor = {type: 'select', data: dcrTypeList, valueField: 'dcr_type', textField: 'str_value'} ;
for (var i = 0; i < dcrTypeList.length; i++) { if (dcrTypeList[i]['dcr_type'] == record.dcr_type) return dcrTypeList[i]['str_value']; } return ""; } } } }
