Using current (26.1.40) Blazor controls, in Blazor Web App, OData (v4) grid updates have started failing. In existing app, they used to work OK, but have started to fail.
Traced cause to Grid update is generating HTTP Patch to OData controller, including ALL FIELDS, including associated entries, even if just one field (e.g. Notes was updated).
The included Grid looks like this:
<SfGrid ID = "Grid" TValue = "ScripTransaction" @ ref = "Grid" AllowPaging = false Height = "100%" Width = "100%" EnableVirtualization = true ShowColumnChooser = true AllowSelection = true AllowSorting = true AllowFiltering = true AllowGrouping = true AllowResizing = true RowHeight = @ClientData.AppLayout.DefaultRowHeight Query = Qry > <SfDataManager @ ref = "dm" Url = "odata/ScripTransactions" DataType = "ScripTransaction" Adaptor = "Adaptors.ODataV4Adaptor" Key = "Id" /> <GridFilterSettings Type = @MyFilterType /> <GridPageSettings PageSize = "100" /> <GridSortSettings> <GridSortColumns> <GridSortColumn Field = "Traded" Direction = "SortDirection.Descending" /> </GridSortColumns> </GridSortSettings> <GridGroupSettings ShowDropArea = false ShowGroupedColumn = true /> <GridTemplates> <ToolbarTemplate> <CToolBar @ ref = "MyToolBar" MyGrid = @Grid SelectedRowIndex = @SelectedRowNum IsEdit = @Grid.IsEdit MyEditMode = @MyEditMode /> </ToolbarTemplate> </GridTemplates> <GridColumns> <GridColumn Field = "@nameof(st.Id)" HeaderText = "Id" IsPrimaryKey = true IsIdentity = true Width = "80" Visible = false /> <DateCol Field = "@nameof(st.Traded)" HeaderText = "Traded" /> <GridColumn Field = "@nameof(st.TranType)" HeaderText = "Tran Type" Width = "70" /> <GridColumn Field = "@nameof(st.Status)" Width = "90" > <EditTemplate> <CDropDownList ID = "stStatus" TItem = "ReferenceList" TValue = "string" @ bind-Value = "@((context as ScripTransaction)!.Status)" DataSource = "@StatusList" PopupWidth = 200 > <DropDownListFieldSettings Value = "Key" Text = "Key" /> </CDropDownList> </EditTemplate> </GridColumn> <GridColumn Field = "@nameof(st.Account)" HeaderText = "Account" Width = "100" Visible = false ></GridColumn> <GridColumn Field = "@nameof(st.CustodyAccount)" HeaderText = "Custody" Width = "80" Visible = false ></GridColumn> <GridColumn Field = "@nameof(st.CashAccount)" HeaderText = "Cash Acct" Width = "80" Visible = false ></GridColumn> <DateCol Field = "@nameof(st.Settled)" HeaderText = "Settled" /> <DateCol Field = "@nameof(st.TaxDate)" HeaderText = "Tax Date" Visible = false /> <GridColumn Field = "@nameof(st.Instrument)" HeaderText = "Inst Id" Width = "80" EditorSettings = "@NumEditParams" Visible = false /> <GridColumn Field = "InstrumentE.Code" HeaderText = "Inst" Width = "80" AllowEditing = false > <Template> @{ ScripTransaction st = (context as ScripTransaction); if (st?.InstrumentE != null) { <a rel = 'nofollow' href = "instrument/@st?.Instrument.ToString()" target = "inst" > @st?.InstrumentE.Code </a> } } </Template> </GridColumn> <GridColumn Field = "InstrumentE.Name" HeaderText = "Name" Width = "280" ></GridColumn> <GridColumn Field = "@nameof(st.Broker)" Width = "90" > <EditTemplate> <CDropDownList ID = "stBroker" TItem = "Broker" TValue = "string" @ bind-Value = "@((context as ScripTransaction)!.Broker)" DataSource = "@Brokers" PopupWidth = 200 > <DropDownListFieldSettings Value = "Id" Text = "Name" /> </CDropDownList> </EditTemplate> </GridColumn> <GridColumn Field = "@nameof(st.Notes)" HeaderText = "Notes" /> <GridColumn Field = "@nameof(st.Order)" HeaderText = "Order" Width = "90" /> <GridColumn Field = "@nameof(st.ContractNote)" HeaderText = "Con Note" /> ...
Copy If I ONLY UPDATE the [Notes] field, then attempt save: the following PATCH request body is generated:
{ "Id" : 741788 , "LastModified" : "2024-07-04T10:41:49.323+10:00" , "TranType" : "Buy" , "Traded" : "2024-03-08T00:00:00+11:00" , "Settled" : "2024-03-13T00:00:00+11:00" , "InstrumentCode" : null , "ParentInstCode" : null , "TaxDate" : "2024-03-08T00:00:00+11:00" , "Instrument" : 10748 , "ParentInst" : null , "Account" : "RE000001.2" , "CashAccount" : "RE000001.3" , "CustodyAccount" : null , "Status" : "Settled" , "DisplayToClient" : null , "Location" : "Custody" , "Broker" : "CMC" , "Custodian" : null , "Order" : null , "ContractNote" : null , "Quantity" : 1175.000000 , "Price" : 8.8100000000 , "Currency" : "AUD" , "AcctExchRate" : 1.00000000 , "CashExchRate" : 1.00000000 , "BeneExchRate" : 1.00000000 , "FeeAuto" : null , "Fee" : 11.0000 , "FeeRule" : 15 , "CostBaseOrig" : 10362.7500 , "Batch" : null , "Source" : null , "ContraID" : null , "InstrumentEvent" : null , "Notes" : "Mistake. Intended Sell Orderss" , "GlClientAuto" : null , "GlAdminAuto" : null , "MigrationSource" : null , "Created" : "2024-03-12T14:19:48.9+11:00" , "CreatedBy" : 31 , "LastModifiedBy" : 42 , "ScripAllocation" : null , "FixedCostBase" : false , "Strategy" : null , "StrategyDate" : null , "Num" : null , "Value" : 10351.7500 , "AcctValue" : 10362.7500 , "CashAcctValue" : 10362.7500 , "Allocations" : [], "Disposals" : [], "GlEntries" : [], "ScripTranTypeE" : null , "InstrumentE" : { "Id" : 10748 , "LastModified" : "2023-11-09T10:35:49.4+11:00" , "Name" : "Data#3 Ltd. FPO" , "Market" : "ASX" , "Exchange" : null , "Type" : "fpo" , "SubType" : "FPO" , "Status" : "A" , "IsTradeable" : false , "Units" : "Shares" , "Currency" : "AUD" , "OrderByValue" : false , "PricingFrequency" : "Daily" , "LiveQuoteAvail" : false , "PricingSource" : 6 , "PricingSourceCode" : "DTL" , "PricingSourceMultiple" : 1.000000 , "EventSource" : null , "LastPriceUpdate" : null , "LastEvent" : null , "APIRCode" : null , "MinOrderValue" : 0.0000 , "MinOrderUnits" : 0.0000 , "OrderMultiples" : 1.0000 , "AllowSpecieTransfers" : false , "MaturityDate" : null , "PenaltyPreMaturity" : false , "CGTType" : "Capital" , "ParcelAllocLocation" : "None" , "WHTaxCountry" : "AUS" , "WHTSetting" : null , "Created" : "2021-11-23T17:29:25.067+11:00" , "Company" : "DATA#3 LIMITED" , "Code" : "DTL" , "TradingCalendar" : "ASX" , "Issued" : 154704064 , "Listed" : "1997-12-18T00:00:00+11:00" , "GICS" : "4510000" , "DeListed" : null , "CreatedBy" : 31 , "ISIN" : "AU000000DTL4" , "SEDOL" : "6093015" , "LastModifiedBy" : 31 , "FrankedPct" : 1.0000 , "FrankingRate" : 0.3000 , "InstrumentTypeE" : null , "MarketE" : null , "InstStat" : null , "ScripTransactions" : [], "HistDailies" : [], "Transactions" : [], "EventLogs" : [], "Notes" : [], "Events" : [], "GlTransactions" : [], "Components" : [], "Versions" : [], "StrategyEvents" : [], "GICSCategoryE" : null , "Orders" : [], "InstHistStats" : [], "InstHistories" : [] }, "OrderE" : null , "InstEvent" : null }
Copy
This request fails, as many of the unedited fields are not editable. Please advise.
-->Run the attached sample then try to edit any one field, you will see the issue