LiguiUI 設置單元格是否可編輯



 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 "";
                            }
                        }
                    }
              
                }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章