No query for new data when changing the ODataV4 URL

Hi,

when the component is started, the data for the dependent second datagrid is queried correctly.

When you select a row in the first datagrid, the description text is updated correctly, but the second datagrid is not updated.


Please give me a hint or example where it works.

Initiail:


After Selection:



Attachment: Sample2Grid_1721eaf8.zip

1 Reply 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team August 20, 2021 07:19 AM UTC

Hi Frank,  
 
Thanks for contacting Syncfusion support.  
 
Query: “When you select a row in the first datagrid, the description text is updated correctly, but the second datagrid is not updated. 
 
We have analyzed the reported query and we understand that you are facing issue when trying to filter the Grid data by changing the parameters in Url string. Instead of changing the parameters in the URL string, we request you to use Query property of Grid to filter the detail Grid datasource. 
 
Refer the below code example.  
 
<SfGrid TValue="Order" AllowPaging="true"> 
    <GridPageSettings PageSize="4"></GridPageSettings> 
    <GridEvents RowSelected="RowSelecthandler" RowDeselected="Deselected"  TValue="Order"></GridEvents> 
    <SfDataManager Url=https://services.odata.org/V4/Northwind/Northwind.svc/Orders Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn> 
        <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn> 
        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
    </GridColumns> 
</SfGrid> 
<h4>Kostenstellen des Geschaeftsfeldes: @AbteilungBez</h4> 
<SfGrid TValue="Customer" Query="@Qry" AllowPaging="true"> 
    <GridPageSettings PageSize="5"></GridPageSettings> 
                   Adaptor="Adaptors.ODataV4Adaptor"> 
  
    </SfDataManager> 
    <GridColumns> 
        <GridColumn Field=@nameof(Customer.CustomerID) HeaderText="ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Customer.Address) HeaderText="Kostenstelle" Width="150"></GridColumn> 
    </GridColumns> 
</SfGrid> 
  
@code 
{ 
    public Query Qry { getset; } 
    public class Order 
    { 
        public int? OrderID { getset; } 
        public string CustomerID { getset; } 
        public DateTime? OrderDate { getset; } 
        public double? Freight { getset; } 
    } 
    public class Customer 
    { 
        public string CustomerID { getset; } 
        public string Address { getset; } 
    } 
  
    public string AbteilungBez { getset; } 
  
    public void RowSelecthandler(RowSelectEventArgs<Order> args) 
    { 
        Qry = new Query().Where("CustomerID""equal", args.Data.CustomerID); 
        AbteilungBez = args.Data.CustomerID; 
    } 
    public void Deselected(RowDeselectEventArgs<Order> Args) 
    { 
        Qry = new Query() { }; 
    } 
 
  
Kindly refer the below sample for your reference 
 
 
Refer our UG documentation for your reference 
 
 
Please get back to us If you have further queries.  
 
Regards, 
Vignesh Natarajan 


Marked as answer
Loader.
Up arrow icon