From 2aac97caeb6a0114d578c8b449df0588f7827276 Mon Sep 17 00:00:00 2001 From: IGvaleries Date: Tue, 23 Sep 2025 14:09:41 -0400 Subject: [PATCH] fix issue clicking main Chart button at top of page - previously no data was being displayed in the chart --- samples/grids/grid/finjs/App.razor | 356 +++++++++++++++-------------- 1 file changed, 181 insertions(+), 175 deletions(-) diff --git a/samples/grids/grid/finjs/App.razor b/samples/grids/grid/finjs/App.razor index 5cf30b1a23..04a13eb7ec 100644 --- a/samples/grids/grid/finjs/App.razor +++ b/samples/grids/grid/finjs/App.razor @@ -33,16 +33,16 @@
+ AutoGenerate="false" + RowSelection="GridSelectionMode.Multiple" + PrimaryKey="id" + AllowFiltering="true" + FilterMode="FilterMode.ExcelStyleFilter" + HideGroupedColumns=true + CellClick="OnCellClick" + Name="grid1" + Id="grid1" + @ref="grid1"> @@ -51,7 +51,7 @@ - @**@ + Header="Category" + Width="120px" + DataType="GridColumnDataType.String" + Sortable="true" + Editable="true" + Resizable="true"> + Header="Type" + Width="100px" + DataType="GridColumnDataType.String" + Sortable="true" + Editable="true" + Resizable="true"> + Header="Contract" + Width="110px" + DataType="GridColumnDataType.String" + Sortable="true" + Groupable="true" + Editable="true"> + Width="100px" + Header="Country" + DataType="GridColumnDataType.String" + Sortable="true" + Editable="true"> @**@ + Width="100px" + Header="Open" + DataType="GridColumnDataType.Currency" + Sortable="true" + Filterable="true" + Editable="true"> + Width="100px" + Header="Price" + BodyTemplateScript="PriceTemplate" + CellClassesScript="trends" + DataType="GridColumnDataType.Currency" + Sortable="true" + Filterable="true" + Editable="true"> + BodyTemplate="ChartButtonTemplate" + Width="100px" + Header="Chart"> + Width="120px" + Header="Change" + CellClassesScript="trendsChange" + DataType="GridColumnDataType.Number" + Sortable="true" + Filterable="true" + Editable="true"> + CellClassesScript="trendsChange" + Width="120px" + Header="Change %" + DataType="GridColumnDataType.Percent" + Sortable="true" + Filterable="true" + Editable="true"> + Width="110px" + Header="Buy" + DataType="GridColumnDataType.Currency" + Sortable="true" + Filterable="true"> + Width="110px" + Header="Sell" + DataType="GridColumnDataType.Currency" + Sortable="true" + Filterable="true"> + Width="110px" + Header="Spread" + DataType="GridColumnDataType.Number" + Sortable="true" + Filterable="true"> + Width="110px" + Header="Volume" + DataType="GridColumnDataType.Number" + Sortable="true" + Filterable="true"> - + + Width="100px" + Header="Settlement" + DataType="GridColumnDataType.String" + Sortable="true" + Editable="true" + Resizable="true"> + Width="120px" + Header="Last Updated" + DataType="GridColumnDataType.Date" + Sortable="true" + Filterable="true" + Editable="true"> + Width="110px" + DataType="GridColumnDataType.Currency" + Sortable="true" + Filterable="true"> + Width="110px" + DataType="GridColumnDataType.Currency" + Sortable="true" + Filterable="true"> + Width="110px" + DataType="GridColumnDataType.Currency" + Sortable="true" + Filterable="true"> + Width="110px" + DataType="GridColumnDataType.Currency" + Sortable="true" + Filterable="true"> + Width="110px" + Filterable="false"> + Width="100px" + Filterable="false"> + Width="100px" + Filterable="false"> + Width="90px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="90px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="120px" + Filterable="false"> + Width="80px" + Filterable="false"> + Width="100px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="80px" + Filterable="false"> + Width="120px" + Filterable="false"> + Width="110px" + Filterable="false"> + Width="90px" + Filterable="false"> + Width="50px" + Filterable="false"> + Width="80px" + Filterable="false"> + Width="110px" + Filterable="false"> + Width="100px" + Filterable="false"> + Width="100px" + Filterable="false"> + Width="90px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="60px" + Filterable="false"> + Width="90px" + Filterable="false"> @@ -379,7 +379,7 @@ public IgbDialog Dialog; public IgbToast Toast; public object[] SelectedRows; - + public string CurrentPriceStatus = "START PRICES"; protected override async Task OnAfterRenderAsync(bool firstRender) @@ -475,14 +475,20 @@ } public async void ShowChart() - { + { this.SelectedRows = this.grid1.SelectedRows; if (this.SelectedRows == null || this.SelectedRows.Length == 0) { await this.Toast.ShowAsync(); return; } - this.Chart.DataSource = this.SelectedRows; + object[] chartDs = new object[this.SelectedRows.Count()]; + for (int i=0; i< this.SelectedRows.Count();i++) + { + int index = int.Parse(this.SelectedRows[i].ToString()); + chartDs[i] = this.CurrentData[index]; + } + this.Chart.DataSource = chartDs; this.Chart.IncludedProperties = new string[2] { "price", "country" }; this.SetChartConfig("Countries", "Prices (USD)", "Data Chart with prices by Category and Country"); await this.Dialog.ShowAsync();