/// <summary> /// 构建单据列表的列信息 /// </summary> /// <param name="xtype"></param> /// <param name="fieldname"></param> /// <param name="header"></param> /// <param name="helpid"></param> /// <param name="combodata"></param> /// <param name="declen"></param> /// <returns></returns> public static ExtGridColumnInfoBase BuildBillListColumn(string xtype, string fieldname, string header, string helpid, string combodata, int declen) { ExtGridColumnInfoBase columnInfo = null; if (xtype == "ngRichHelp" && !string.IsNullOrWhiteSpace(helpid)) { var col = new ExtGridHelpColumnInfo(fieldname + "_name", header); col.helpid = helpid; columnInfo = col; } else if (xtype == "ngComboBox") { var col = new ExtGridComboBoxColumnInfoForList(fieldname, header); col.renderer = new IndividualUIRule().GetRenderer(combodata); columnInfo = col; } else if (xtype == "ngDate") { columnInfo = new ExtGridDateColumnInfo(fieldname, header); } else if (xtype == "ngDateTime") { columnInfo = new ExtGridDateTimeColumnInfo(fieldname, header); } else if (xtype == "ngNumber") { columnInfo = new ExtGridNumberColumnInfo(fieldname, header, declen); } else { columnInfo = new ExtGridColumnInfoBase(fieldname, header); } return(columnInfo); }
public static ExtGridColumnInfoBase Build(string xtype, string fieldname, string header, string helpid, string combodata, int length, int declen) { ExtGridColumnInfoBase columnInfo = null; if (xtype == "ngRichHelp" && !string.IsNullOrWhiteSpace(helpid)) { columnInfo = new ExtGridColumnInfoBase(fieldname + "_name", header); IndividualPropertyDac dac = new IndividualPropertyDac(); ExtGridColumnHelpEditor editor = new ExtGridColumnHelpEditor(); editor.helpid = helpid; DataTable dt = dac.GetHelpInfo(helpid); if (dt.Rows.Count > 0) { string codeField = dt.Rows[0]["codefield"].ToString().Trim(); if (codeField.IndexOf('.') > 0) { editor.valueField = codeField.Split('.')[1]; } else { editor.valueField = codeField; } string nameField = dt.Rows[0]["namefield"].ToString(); if (nameField.IndexOf('.') > 0) { editor.displayField = nameField.Split('.')[1]; } else { editor.displayField = nameField; } } editor.isInGrid = true; editor.xtype = xtype; editor.ORMMode = false;//自定义字段为false Listeners ls = new Listeners(); ls.helpselected = "function (obj) {var data = this.findParentByType('ngGridPanel').getSelectionModel().getSelection();" + string.Format("data[0].set('{0}', obj.code); data[0].set('{1}', obj.name); ", fieldname, fieldname + "_name") + "}"; editor.listeners = ls; columnInfo.editor = editor; } else if (xtype == "ngComboBox") { var col = new ExtGridComboBoxColumnInfo(fieldname, header); ExtGridComboBoxEditor editor = new ExtGridComboBoxEditor(); editor.valueField = "code"; editor.displayField = "name"; editor.queryMode = "local"; editor.xtype = xtype; editor.data = TranslateData(combodata, ';', '|'); col.editor = editor; col.renderer = new IndividualUIRule().GetRenderer(combodata); columnInfo = col; } else if (xtype == "ngDate") { columnInfo = new ExtGridDateColumnInfo(fieldname, header); ExtGridColumnEditorBase editor = new ExtGridColumnEditorBase(); editor.xtype = xtype; columnInfo.editor = editor; } else if (xtype == "ngDateTime") { columnInfo = new ExtGridDateTimeColumnInfo(fieldname, header); ExtGridColumnEditorBase editor = new ExtGridColumnEditorBase(); editor.xtype = xtype; columnInfo.editor = editor; } else if (xtype == "ngNumber") { columnInfo = new ExtGridNumberColumnInfo(fieldname, header, declen); ExtGridNumberEditor editor = new ExtGridNumberEditor(); editor.xtype = xtype; editor.decimalPrecision = declen; editor.maxValue = GetMaxVal(length, declen); columnInfo.editor = editor; } else if (xtype == "ngPercent")//百分比 { columnInfo = new ExtGridPerCentColumnInfo(fieldname, header, declen); ExtGridNumberEditor editor = new ExtGridNumberEditor(); editor.xtype = "ngNumber"; editor.decimalPrecision = declen; editor.showPercent = true; editor.step = 0.01; columnInfo.editor = editor; } else { columnInfo = new ExtGridColumnInfoBase(fieldname, header); ExtGridColumnEditorBase editor = new ExtGridColumnEditorBase(); editor.xtype = xtype; columnInfo.editor = editor; } return(columnInfo); }