public void ProcessAction(DevExpress.XtraPivotGrid.PivotCellEventArgs e) { PivotGridListEditor listEditor = ((DevExpress.ExpressApp.ListView)View).Editor as PivotGridListEditor; int columnIndex = e.ColumnIndex; int rowIndex = e.RowIndex; PivotDrillDownDataSource drillDown = listEditor.PivotGridControl.CreateDrillDownDataSource(columnIndex, rowIndex); List <object> keysToShow = new List <object>(); for (int i = 0; i < drillDown.RowCount; i++) { object obj = drillDown[i][0]; if (obj != null) { keysToShow.Add(ObjectSpace.GetKeyValue(obj)); } } if (keysToShow.Count > 0) { string viewId = Application.GetListViewId(View.ObjectTypeInfo.Type); CollectionSourceBase collectionSource = Application.CreateCollectionSource(Application.CreateObjectSpace(), View.ObjectTypeInfo.Type, viewId); collectionSource.Criteria["SelectedObjects"] = new InOperator(ObjectSpace.GetKeyPropertyName(View.ObjectTypeInfo.Type), keysToShow); DevExpress.ExpressApp.ListView listView = Application.CreateListView(viewId, collectionSource, true); ShowViewParameters svp = new ShowViewParameters(listView); svp.TargetWindow = TargetWindow.NewModalWindow; //svp.Context = TemplateContext.View; Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(Frame, null)); } }
protected override void OnActivated() { base.OnActivated(); var listView = View as ListView; if (listView != null && listView.Editor != null && listView.Editor.GetType() == typeof(PivotGridListEditor)) { _pivotGridListEditor = (PivotGridListEditor)listView.Editor; _pivotGridListEditor.CreateCustomModelSynchronizer += PivotGridListEditorOnControlsCreated; } }
void View_ControlsCreated(object sender, EventArgs e) { PivotGridListEditor listEditor = ((DevExpress.ExpressApp.ListView)View).Editor as PivotGridListEditor; if (listEditor != null) { listEditor.PivotGridControl.CellDoubleClick += OnPivotGridControlCellDoubleClick; } }
protected override void OnActivated() { base.OnActivated(); var listView = View as ListView; if (listView != null && listView.Editor != null && listView.Editor.GetType() == typeof(PivotGridListEditor)) { _pivotGridListEditor = (PivotGridListEditor)listView.Editor; _pivotGridListEditor.ModelApplied += PivotGridListEditorOnModelApplied; _pivotGridListEditor.ModelSaved += PivotGridListEditorOnModelSaved; } }
public PivotGridListEditorModelSynchronizer(PivotGridListEditor columnViewEditor) : base(columnViewEditor, columnViewEditor.Model) { ModelSynchronizerList.Add(new PivotGridFieldSynchronizer(columnViewEditor)); ModelSynchronizerList.Add(new PivotGridEditorSynchronizer(columnViewEditor)); }
public PivotGridEditorSynchronizer(PivotGridListEditor pivotGridListEditor) : base(pivotGridListEditor.PivotGridControl, ((IModelListViewOptionsPivotGrid)pivotGridListEditor.Model).OptionsPivotGrid, false) { }
public PivotGridFieldSynchronizer(PivotGridListEditor component) : base(component.PivotGridControl, (IModelListViewOptionsPivotGrid)component.Model) { }
protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); // Access and customize the target View control. try { if (View == null) { return; } DevExpress.ExpressApp.ListView lv = View as DevExpress.ExpressApp.ListView; if (lv == null) { return; } PivotGridListEditor editor = lv.Editor as PivotGridListEditor; if (editor == null) { if (lv.Model != null) { editor = new PivotGridListEditor(lv.Model); lv.Editor = editor; } else { return; } } if (editor.PivotGridControl != null) { PV = editor.PivotGridControl; } else { PV = new PivotGridControl(); PV.DataSource = editor.DataSource; } if (PV == null) { return; } PV.FieldAreaChanging += PV_FieldAreaChanging; PV.PopupMenuShowing += PV_PopupMenuShowing; PV.CustomCellValue += PV_CustomCellValue; PV.OptionsView.ShowTotalsForSingleValues = true; PV.OptionsView.ShowGrandTotalsForSingleValues = true; PV.OptionsView.ShowRowGrandTotalHeader = true; PV.OptionsView.ShowRowGrandTotals = true; PV.OptionsView.ShowRowTotals = false; PV.OptionsView.ShowColumnTotals = true; PV.OptionsView.ShowColumnGrandTotals = true; PV.OptionsView.ShowColumnGrandTotalHeader = true; PV.Fields.Clear(); // в строку: сотрудник и его должность и фот ручками PV.Fields.Add(new PivotGridField() { Name = "Person", FieldName = "Person.ShortName", Area = PivotArea.RowArea, Caption = "Сотрудник" }); PV.Fields.Add(new PivotGridField() { Name = "StaffNumber", FieldName = "DeptPost.StaffNumber", Area = PivotArea.RowArea, Caption = "Табельный номер" }); PV.Fields.Add(new PivotGridField() { Name = "DeptPost", FieldName = "DeptPost.idPost.PostName", Area = PivotArea.RowArea, Caption = "Должность" }); DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit decimaledit = new DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit(); //колонки из проектов и этапов этих проектов (вложенные банды) PV.Fields.Add(new PivotGridField() { Name = "Project", FieldName = "Project.Name", Area = PivotArea.ColumnArea, Caption = "Проект" }); PV.Fields.Add(new PivotGridField() { Name = "Task", FieldName = "Task.Name", Area = PivotArea.ColumnArea, Caption = "Этап" }); //значение в срезе - кту PivotGridField ktu = new PivotGridField(); ktu.Name = "ktu"; ktu.FieldName = "KTU"; ktu.Area = PivotArea.DataArea; ktu.AreaIndex = 0; ktu.Caption = "КТУ"; ktu.CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ktu.CellFormat.FormatString = "N2"; //editor для редактирования PV.RepositoryItems.Add(decimaledit); ktu.FieldEdit = decimaledit; ktu.Options.AllowEdit = false; ktu.Options.ShowTotals = true; ktu.Options.ShowGrandTotal = true; PV.Fields.Add(ktu); PV.Fields.Add(new PivotGridField() { Name = "Month", FieldName = "Form.Period.PeriodMounth", Area = PivotArea.FilterArea, Caption = "Месяц", AreaIndex = 0 }); PV.Fields.Add(new PivotGridField() { Name = "Year", FieldName = "Form.Period.PeriodYear", Area = PivotArea.FilterArea, Caption = "Год", AreaIndex = 1 }); //по подразделениям PV.Fields.Add(new PivotGridField() { Name = "Dept", FieldName = "Form.DeptBook.SubjDept.SubjName", Area = PivotArea.RowArea, Caption = "Подразделение", AreaIndex = 0 }); //связанная колонка с выражением - фот по проекту у сотрудника PivotGridField fot = new PivotGridField(); fot.Name = "fot"; fot.FieldName = "SumFOT"; fot.Area = PivotArea.DataArea; fot.Caption = "ФОТ"; fot.CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric; fot.CellFormat.FormatString = "C"; fot.Visible = true; fot.SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Sum; fot.Options.ShowValues = false; fot.Options.ShowGrandTotal = true; fot.Options.ShowTotals = true; PV.Fields.Add(fot); PV.Visible = true; } catch (Exception ex) { System.Diagnostics.Trace.TraceError(ex.ToString()); } }