We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Add to detail manually

Using a sfDataGrid, using master/detail.  Pulling in information from my WooCommerce site.  Two things I am having trouble doing:

1) I want to remove some columns in the details section

2) The details section is not automatically adding data that I retrieve.  Such as the billing information.  How can I add this to my dictionary so that it's included in the datasource? Here is my code:

Dim baseUrl = "https://www.example.com/wp-json/wc/v3/"
        Dim key = "ck_1234"
        Dim secret = "cs_1234"
        Dim rest As RestAPI = New RestAPI(baseUrl, key, secret, False)
        Dim wc As WCObject = New WCObject(rest)
        'Dim orders = Await wc.Order.GetAll
        Dim orders = Await wc.Order.GetAll(New Dictionary(Of String, String) From {
        {"per_page", "100"}
})



Attachment: billing_c6daa5e4.zip

1 Reply

SS Susmitha Sundar Syncfusion Team December 17, 2019 12:42 PM UTC

Hi Jeff, 
 
Thank you for using Syncfusion controls. 
  
Please find the details for your reported queries. 
 
Query 1: I want to remove some columns in the details section 
 
You can get the DetailsViewGrid from GetDetailsViewGrid() method. And then you can remove the columns from that grid. Please refer the below code snippet, 
 
VB#: 
Private Sub RemoveButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles RemoveButton.Click 
       Dim detailViewGrid = sfDataGrid1.GetDetailsViewGrid(2) 
       detailViewGrid.Columns.RemoveAt(1) 
       sfDataGrid1.TableControl.Invalidate() 
End Sub 
 
Query 2: The details section is not automatically adding data that I retrieve 
 
You can add new data to the DetailsViewDataGrid data source. Please refer the below code snippet, 
 
VB#: 
Private Sub AddNewRow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click 
       Dim orderDetails = New OrderDetails(10000, 12, 23, 5, 10, "ALFKI", New Date(2019, 12, 17)) 
       Dim detailViewGrid = sfDataGrid1.GetDetailsViewGrid(2) 
       Dim collection As ObservableCollection(Of OrderDetails)=TryCast(detailViewGrid.DataSource, ObservableCollection(Of OrderDetails)) 
       collection.Add(orderDetails) 
End Sub 
 
We have checked this with our 17.3.0.14 version. Its works fine from our end.  
We have prepared the sample for the same, please refer the below sample and let us know if you need further assistance. 
 
 
Regards, 
Susmitha S 


Loader.
Live Chat Icon For mobile
Up arrow icon