ILayoutCellEditor ListParamsRetriveCellEditor(object listItem, object value, ILayoutCell cell) { if (cell.Name == nameof(QParam.Value)) { QParam param = (QParam)listItem; ILayoutCellEditor editor = null; if (param != null && param.Column != null && !editors.TryGetValue(param, out editor)) { if ((param.Column.IsPrimaryKey || param.Column.IsReference) && param.Comparer.Type == CompareTypes.In) { if (!(param.Value is QQuery) && param.Column.IsReference && param.Value == null) { var sub = new QQuery(string.Empty, param.Column.ReferenceTable); sub.BuildColumn(param.Column.ReferenceTable.PrimaryKey); param.ValueRight = sub; } editor = new CellEditorQuery(); } else { editor = TableLayoutList.InitCellEditor(param.Column); if (param.Column.DataType == typeof(DateTime) && param.Comparer.Equals(CompareType.Between)) { ((CellEditorDate)editor).TwoDate = true; } } editors[param] = editor; } return(editor); } return(null); }
protected override ILayoutCellEditor GetCellEditor(object listItem, object itemValue, ILayoutCell cell) { if (cell.Name == "Column" && cell.GetEditor(listItem) == null) { if (query.Table == null) { return(null); } return(new CellEditorList { DataSource = query.Table.Columns }); } if (cell == colValue) { QParam param = (QParam)listItem; ILayoutCellEditor editor = null; if (param.Column != null) { if ((param.Column.IsPrimaryKey || param.Column.IsReference) && param.Comparer.Type == CompareTypes.In) { if (param.Column.IsReference && param.Value == null) { param.ValueRight = new QQuery(string.Empty, param.Column.ReferenceTable); } editor = new CellEditorQuery(); } else { editor = TableLayoutList.InitCellEditor(param.Column); } return(editor); } } return(base.GetCellEditor(listItem, itemValue, cell)); }