protected virtual void UpdateInfo(VirtualGridCellValueNeededEventArgs args) { this.value = args.Value; this.fieldName = args.FieldName; this.formatString = args.FormatString; this.Text = string.Format(this.formatString, this.value); }
protected override void UpdateInfo(VirtualGridCellValueNeededEventArgs args) { base.UpdateInfo(args); this.UpdateImage(); if (!this.ShowExpanderItem) { return; } this.expanderItem.RadPropertyChanged -= new RadPropertyChangedEventHandler(this.expanderItem_RadPropertyChanged); this.expanderItem.Expanded = this.ViewInfo.IsRowExpanded(this.RowIndex); this.expanderItem.RadPropertyChanged += new RadPropertyChangedEventHandler(this.expanderItem_RadPropertyChanged); }
private void RvgCustomers_CellValueNeeded(object sender, Telerik.WinControls.UI.VirtualGridCellValueNeededEventArgs e) { if (e.ColumnIndex < 0) { return; } if (e.RowIndex == RadVirtualGrid.HeaderRowIndex) { e.Value = ColumnNames[e.ColumnIndex]; } if (e.RowIndex >= 0 && e.RowIndex < CustomerViewModel.GetAllEntities().Count) { e.Value = ((List <Customer>)CustomerViewModel.GetAllEntities())[e.RowIndex][e.ColumnIndex]; } }
protected override void UpdateInfo(VirtualGridCellValueNeededEventArgs args) { this.FieldName = args.FieldName; this.SetSelectedFilterOperatorText(); int num = (int)this.SetValue(VirtualGridFilterCellElement.IsFilterAppliedProperty, (object)(this.Descriptor != null)); if (this.Descriptor != null) { this.Text = Convert.ToString(this.Descriptor.Value); } else { this.Text = string.Empty; } }
private void RadVirtualGrid1_CellValueNeeded(object sender, Telerik.WinControls.UI.VirtualGridCellValueNeededEventArgs e) { if (e.ColumnIndex < 0) { return; } if (e.RowIndex == RadVirtualGrid.HeaderRowIndex) { e.Value = this.repository.ColumnNames[e.ColumnIndex]; } if (e.RowIndex >= 0 && e.RowIndex < this.data.Count * (this.radVirtualGrid1.PageIndex + 1)) { int index = e.RowIndex - this.radVirtualGrid1.PageSize * this.radVirtualGrid1.PageIndex; e.Value = this.data[index][e.ColumnIndex]; } }
public virtual void Synchronize(bool updateContent) { this.IsPinned = this.tableElement.IsRowPinned(this.rowIndex) || this.tableElement.IsColumnPinned(this.Data); this.IsSelected = this.tableElement.GridElement.Selection.IsSelected(this.RowIndex, this.ColumnIndex, this.ViewInfo); if (this.tableElement.GridElement.CurrentCell != null && this.tableElement.GridElement.CurrentCell.ViewInfo == this.ViewInfo) { this.IsCurrentRow = this.tableElement.GridElement.CurrentCell.RowIndex == this.rowIndex; this.IsCurrentColumn = this.tableElement.GridElement.CurrentCell.ColumnIndex == this.columnIndex; this.IsCurrent = this.IsCurrentRow && this.IsCurrentColumn; } else { this.IsCurrentRow = this.IsCurrentColumn = this.IsCurrent = false; } if (updateContent) { VirtualGridCellValueNeededEventArgs args = new VirtualGridCellValueNeededEventArgs(this.rowIndex, this.columnIndex, this.ViewInfo); this.tableElement.GridElement.OnCellValueNeeded(args); this.UpdateInfo(args); } this.tableElement.GridElement.OnCellFormatting(new VirtualGridCellElementEventArgs(this, this.ViewInfo)); }
//private void LoadData() //{ // this.radVirtualGrid1.RowCount = treeTables.Count; // this.radVirtualGrid1.ColumnCount = 5; //} private void loadTable(Telerik.WinControls.UI.VirtualGridCellValueNeededEventArgs e) { if (e.ViewInfo == this.radVirtualGrid1.MasterViewInfo) { if (e.ColumnIndex < 0) { return; } e.FieldName = Project.FieldNames[e.ColumnIndex]; if (e.RowIndex == RadVirtualGrid.HeaderRowIndex) { e.Value = e.FieldName; } else if (e.RowIndex >= 0) { double all = 5; double sum = 0; switch (e.ColumnIndex) { case 0: e.Value = treeTables[e.RowIndex].Project.ProjectName; break; case 1: e.Value = treeTables[e.RowIndex].Project.ClientName; break; case 2: e.Value = treeTables[e.RowIndex].Project.User.UserName; break; case 3: all = treeTables[e.RowIndex].Project.DevelopersHours + treeTables[e.RowIndex].Project.QaHours + treeTables[e.RowIndex].Project.UiUxHours; e.Value = all; break; case 4: sum = 0; foreach (var item in treeTables[e.RowIndex].DetailsWorkerInProjects) { foreach (var item2 in item.ActualHours) { sum += item2.CountHours; } } e.Value = sum; break; case 5: all = treeTables[e.RowIndex].Project.DevelopersHours + treeTables[e.RowIndex].Project.QaHours + treeTables[e.RowIndex].Project.UiUxHours; sum = 0; foreach (var item in treeTables[e.RowIndex].DetailsWorkerInProjects) { foreach (var item2 in item.ActualHours) { sum += item2.CountHours; } } double precent = sum / all * 100; if (precent == 0) { e.Value = "0%"; } else { e.Value = precent.ToString() + "%"; } break; case 6: e.Value = treeTables[e.RowIndex].Project.StartDate.ToString(); break; case 7: e.Value = treeTables[e.RowIndex].Project.FinishDate.ToString(); break; case 8: e.Value = treeTables[e.RowIndex].Project.IsActive.ToString(); break; default: break; } } } else if (e.ViewInfo.HierarchyLevel == 2) { if (e.ColumnIndex < 0) { return; } e.FieldName = DetailsWorkerInProjects.FieldNames[e.ColumnIndex]; if (e.RowIndex == RadVirtualGrid.HeaderRowIndex) { e.Value = e.FieldName; } else if (e.RowIndex >= 0) { var w = e.ViewInfo.ParentViewInfo.ParentRowIndex; switch (e.ViewInfo.ParentRowIndex) { case 0: detailsByKind = treeTables[w].DetailsWorkerInProjects.Where(d => d.Kind == "Developers").ToList(); break; case 1: detailsByKind = treeTables[w].DetailsWorkerInProjects.Where(d => d.Kind == "QA").ToList(); break; case 2: detailsByKind = treeTables[w].DetailsWorkerInProjects.Where(d => d.Kind == "UI/UX").ToList(); break; default: break; } if (detailsByKind.Count > 0) { if (e.RowIndex < detailsByKind.Count) { switch (e.ColumnIndex) { case 0: e.Value = detailsByKind[e.RowIndex].TeamLeaderName; break; case 1: e.Value = detailsByKind[e.RowIndex].Name; break; case 2: e.Value = detailsByKind[e.RowIndex].Hours.ToString(); break; case 3: var list = detailsByKind[e.RowIndex].ActualHours; double sum = 0; foreach (var item in list) { sum += item.CountHours; } e.Value = sum.ToString(); break; case 4: double all = detailsByKind[e.RowIndex].Hours; list = detailsByKind[e.RowIndex].ActualHours; sum = 0; foreach (var item in list) { sum += item.CountHours; } double precent = sum / all * 100; if (precent > 0) { e.Value = precent.ToString() + "%"; } else { e.Value = "0%"; } break; default: break; } } } } } else if (e.ViewInfo.HierarchyLevel == 1) { List <string> kinds = new List <string>() { "Kind Name", "Hours", "Actual Hours", "Precent" }; List <string> kindsNames = new List <string>() { "Developers", "QA", "UI/UX" }; if (e.ColumnIndex < 0) { return; } e.FieldName = kinds[e.ColumnIndex]; if (e.RowIndex == RadVirtualGrid.HeaderRowIndex) { e.Value = e.FieldName; } else { switch (e.ColumnIndex) { case 0: e.Value = kindsNames[e.RowIndex]; break; case 1: switch (e.RowIndex) { case 0: e.Value = treeTables[e.ViewInfo.ParentRowIndex].Project.DevelopersHours; break; case 1: e.Value = treeTables[e.ViewInfo.ParentRowIndex].Project.QaHours; break; case 2: e.Value = treeTables[e.ViewInfo.ParentRowIndex].Project.UiUxHours; break; default: break; } kind = e.Value.ToString(); break; case 2: List <DetailsWorkerInProjects> actuals = new List <DetailsWorkerInProjects>(); switch (e.RowIndex) { case 0: actuals = treeTables[e.ViewInfo.ParentRowIndex].DetailsWorkerInProjects.Where(t => t.Kind == "Developers").ToList(); break; case 1: actuals = treeTables[e.ViewInfo.ParentRowIndex].DetailsWorkerInProjects.Where(t => t.Kind == "QA").ToList(); break; case 2: actuals = treeTables[e.ViewInfo.ParentRowIndex].DetailsWorkerInProjects.Where(t => t.Kind == "UI/UX").ToList(); break; default: break; } double sumActual = 0; foreach (var item in actuals) { foreach (var h in item.ActualHours) { sumActual += h.CountHours; } } e.Value = sumActual; break; case 3: actuals = new List <DetailsWorkerInProjects>(); double all = 0, sum = 0; switch (e.RowIndex) { case 0: all = treeTables[e.ViewInfo.ParentRowIndex].Project.DevelopersHours; actuals = treeTables[e.ViewInfo.ParentRowIndex].DetailsWorkerInProjects.Where(t => t.Kind == "Developers").ToList(); break; case 1: all = treeTables[e.ViewInfo.ParentRowIndex].Project.QaHours; actuals = treeTables[e.ViewInfo.ParentRowIndex].DetailsWorkerInProjects.Where(t => t.Kind == "QA").ToList(); break; case 2: all = treeTables[e.ViewInfo.ParentRowIndex].Project.UiUxHours; actuals = treeTables[e.ViewInfo.ParentRowIndex].DetailsWorkerInProjects.Where(t => t.Kind == "UI/UX").ToList(); break; default: break; } foreach (var item in actuals) { foreach (var h in item.ActualHours) { sum += h.CountHours; } } double precent = sum / all * 100; if (precent == 0) { e.Value = "0%"; } else { e.Value = precent.ToString() + "%"; } break; default: break; } } } else if (e.ViewInfo.HierarchyLevel == 3) { var w = e.ViewInfo.ParentViewInfo.ParentViewInfo.ParentRowIndex; var i = e.ViewInfo.ParentRowIndex; switch (e.ViewInfo.ParentViewInfo.ParentRowIndex) { case 0: detailsByKind = treeTables[w].DetailsWorkerInProjects.Where(d => d.Kind == "Developers").ToList(); break; case 1: detailsByKind = treeTables[w].DetailsWorkerInProjects.Where(d => d.Kind == "QA").ToList(); break; case 2: detailsByKind = treeTables[w].DetailsWorkerInProjects.Where(d => d.Kind == "UI/UX").ToList(); break; default: break; } if (e.ColumnIndex < 0) { return; } e.FieldName = ActualHours.FieldNames[e.ColumnIndex]; if (e.RowIndex == RadVirtualGrid.HeaderRowIndex) { e.Value = e.FieldName; } else if (e.RowIndex >= 0) { try { switch (e.ColumnIndex) { case 0: e.Value = detailsByKind[i].ActualHours[e.RowIndex].CountHours.ToString(); break; case 1: e.Value = detailsByKind[i].ActualHours[e.RowIndex].date.ToString(); break; default: break; } } catch (Exception ex) { } } } }
private void radVirtualGrid1_CellValueNeeded(object sender, Telerik.WinControls.UI.VirtualGridCellValueNeededEventArgs e) { loadTable(e); }