Master/Slave DetailGrid out of sync.

Hello,

So there were two other threads similiar to this question but they weren't using the WebApiAdaptor.

So how the setup work is simple, in the Master Grid we use the RowSelected on item to pass the item id to the slave Url. This work but the system is out of sync and will only update the Slave Datagrid when selecting another row.


<ContentTemplate>
<SfGrid TValue="Market" AllowSelection="true" AllowPaging="true" AllowSorting="true" Toolbar="@Toolbaritems" ID="Grid1">
<SfDataManager Url="@myMarketUrl" Adaptor="Adaptors.WebApiAdaptor">SfDataManager>
<GridPageSettings PageSize="10">GridPageSettings>
<GridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Row" Type="Syncfusion.Blazor.Grids.SelectionType.Single">GridSelectionSettings>
<GridEvents RowSelected="RowSelecthandler" OnToolbarClick="ToolbarClickHandler" TValue="Market">GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" Mode="EditMode.Dialog">GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(Market.MarketId) HeaderText="Market ID" IsPrimaryKey="true" Visible="false" Width="120">GridColumn>
.....
GridColumns>
SfGrid>


<SfGrid @ref="MarketOfferGrid" TValue="MarketOffer" AllowPaging="true">
<GridPageSettings PageSize="8">GridPageSettings>
<SfDataManager Url="@myMarketSelectedRow" Adaptor="Adaptors.WebApiAdaptor">SfDataManager>
<GridColumns>
<GridColumn Field=@nameof(MarketOffer.OfferId) HeaderText="App ID" IsPrimaryKey="true" TextAlign="TextAlign.Right"> GridColumn>
.....
GridColumns>
SfGrid>
ContentTemplate>


public async Task RowSelecthandler(RowSelectEventArgs<Market> Args)
{
myMarketSelectedRow = config["APIUrl"] + "api/v1/MarketOffer/" + Args.Data.MarketId;
await MarketOfferGrid.Refresh();
StateHasChanged();
}


Was hoping to use your guys resources to help me figure this one out. Thanks in advance.


5 Replies

MS Monisha Saravanan Syncfusion Team July 11, 2022 01:02 PM UTC

Hi Johnathon,


We are currently validating your query at our end. We will update further details within two business days on or before (13.07.2022). Until then we appreciate your patience.


Regards,

Monisha



NP Naveen Palanivel Syncfusion Team July 13, 2022 05:34 PM UTC

Hi Johnathon,


We are currently validating your query at our end. We will update further details within two business days on or before (15.07.2022). Until then we appreciate your patience.


Regards,

Naveen Palanivel



NP Naveen Palanivel Syncfusion Team July 19, 2022 05:48 AM UTC

Hi Johnathon,


Sorry for the Inconvenience,


We checked query by given code snippet and we suggest you to use Query property of DataGrid. By using Query property we can bind the selected value through rowselected event to the Grid. The Grid will be automatically refreshed based on the values by using Query property. Kindly refer the below link for your reference.


Reference :

https://blazor.syncfusion.com/demos/datagrid/master-details?theme=bootstrap4

https://blazor.syncfusion.com/documentation/datagrid/data-binding#change-query-parameter-value-dynamically


Please get back to us if you need further assistance


Regards,

Naveen Palanivel



JO Johnathon July 21, 2022 02:40 AM UTC

Dang was hoping this wasnt going to be the solution haha.

Luckily I already implemented this shortly after making this question in hopes there might be a different solution but I'm glad you guys took the time to look into this for me.

Thanks for the suggestion and help.



NP Naveen Palanivel Syncfusion Team July 22, 2022 06:57 PM UTC

Hi Johnathon,


Welcome


We are glad to hear that your query has been resolved by you.


Please get back to us if you need further assistance.


Regards,

Naveen Palanivel.


Loader.
Up arrow icon