Dialog grid calling from another grid via button with parameter

I want to display a dialog child grid from another parent grid via button click with respective child records filled within of respective parentId.

please do help me in resolving this issue.



2 Replies 1 reply marked as answer

RR Rajapandi Ravi Syncfusion Team July 9, 2020 01:30 PM UTC

Hi kahkasha, 

Greetings from syncfusion support 

From validating your query, we suspect that you like to display the another datasource in the dialog based on the parent id. Based on your query we have prepared a sample and achieve your requirement by using ajax post. Using this ajax post we have filter the another datasource value based on the ParentID and bind that datasource to the dialog. Please refer the below code example and sample for more information. 

Index.cshtml 

<script> 
    function commandClick(args) { 
        var dialog = document.getElementById('defaultDialog').ej2_instances[0]; 
        var dialogGrid = document.getElementById('dialog_grid').ej2_instances[0]; 
        var data = args.rowData; 
        var row = JSON.stringify({ rowData: [{ OrderID: data.OrderID, CustomerID: data.CustomerID, ShipName: data.ShipName, ShipCity: data.ShipCity, ShipCountry: data.ShipCountry }] }); 
        var ajaxObj = new ej.base.Ajax(); 
        ajaxObj.type = 'POST'; 
        ajaxObj.contentType = 'application/json'; 
        ajaxObj.url = '/Home/SelectRecord'; 
        ajaxObj.data = row; 
        ajaxObj.send().then(function (value) { 
           var parsed = ej.data.DataUtil.parse.parseJson(value);  
            console.log(parsed); 
            dialogGrid.dataSource = parsed; 
            dialog.show(); 
        }); 
    } 
</script> 
 


HomeController.cs 
 
 
        public ActionResult SelectRecord(SelectedModel row) 
        { 
            var id = row.rowData[0].OrderID; 
            var data = Emp.GetAllDetails(); 
            var filtered = data.FindAll(e => e.OrderID == id); 
            return Json(filtered); 
        } 


Screenshot: 

 

Regards, 
Rajapandi R

Marked as answer

PR Padmini Ramamurthy Syncfusion Team July 10, 2020 08:48 AM UTC

From: Kahkasha sartaj
Sent: Friday, July 10, 2020 4:16 AM
To: Syncfusion Support <[email protected]>
Subject: Re: Syncfusion support community forum 155808, Dialog grid calling from another grid via button with parameter, has been updated
 
  
Thank you so much. your sample code fulfill my requirement perfectly. 


Loader.
Up arrow icon