how to set default property of datagrid column dunamically


Have a look on the snap shot
in which i have select a bank and by clicking of respective row button(Branch) 
all the branches of the selected bank is showing in dialog grid
where i can do CRUD operation for branches.

My issue is that i want to set bank code by default when adding new branch.
using below code---

function actionComplete_Branch(args) {
            debugger;
            if (args.requestType === 'add') {
                //debugger;
                //alert(args.requestType);
                args.form.elements.namedItem('BNK_CD').value = "Branch";
            }
        }

instead of the keyword (Branch) i want show the selected row bank code here.

please help me out to do this.



3 Replies 1 reply marked as answer

SM Shalini Maragathavel Syncfusion Team August 28, 2020 12:34 PM UTC

Hi kahkasha, 
 
Greetings from Syncfusion Support. 
 
From your query we understood that you want to set the selected row data as a default value while adding new record to the Grid. 
 
You can achieve your requirement by using getSelectedRecords method of the Grid as demonstrated in the below code snippet. 
 
function actionComplete(args) { 
        debugger; 
        if (args.requestType === 'add') { 
           
            var grid = document.getElementById("parentGrid").ej2_instances[0]; 
 
            var selectedrow = grid.getSelectedRecords(); 
 
            args.form.elements.namedItem('OrderID').value = selectedrow[0].OrderID; 
 
 
        } 
    } 
 
 
We have prepared a sample based on this for your reference. You can find it below, 
 
 
Let us know if you have any concerns. 
 
Regards, 
Shalini M. 
 
 


Marked as answer

KA kahkasha August 31, 2020 05:54 AM UTC

Thank you so much for the reply
this is exactly what i need to know.


SM Shalini Maragathavel Syncfusion Team August 31, 2020 12:05 PM UTC

Hi kahkasha, 
Thanks for the update. 
We are happy to hear that your issue has been resolved. 
Please get back to us if you need further assistance. 
  
Regards, 
Shalini M. 




Loader.
Up arrow icon