HI,
Hello,
I need to remove a row with composite key and I'm not able to pass the second key as a parameter. I searched and saw some examples for the previous version and tried to apply it but it didn't work.
Can you help?
<e-grid-column field="id"
headerText="id"
textAlign="Left"
isPrimaryKey="true"
visible="false">
</e-grid-column>
<e-grid-column field="estoqueid"
headerText="estoqueid"
textAlign="Left"
isPrimaryKey="true"
visible="false">
</e-grid-column>
function actionBeginDestGrid2(args) {
if (args.requestType == 'delete') {
args.model.dataSource.dataSource.headers = [];
args.model.dataSource.dataSource.headers.push({ "id": args.data.id, "estoqueid": args.data.estoqueid });
}
}
Hi Roberto,
Thanks for contacting Syncfusion support.
Query: I need to remove a row with composite key and I'm not able to pass the second key as a parameter.
By default, the EJ2 grid does not have support for composite keys. All the CRUD actions are performed based on the first primaryKey field only. If you want to send additional value to the server while deleting a record, you can achieve it by using the addParams property of grid.query.
In actionBegin event (requestType as delete), we
dynamically send the EmployeeID value to the server side.
actionBegin: https://ej2.syncfusion.com/javascript/documentation/api/grid/#actionbegin
|
Index.cshtml
function actionBegin(args){ if (args.requestType == "delete") { var grid = document.getElementById('Grid').ej2_instances[0]; var EmployeeID = args.data[0].EmployeeID; // get the row data grid.query = new ej.data.Query().addParams('EmployeeID', EmployeeID); // send your own keys } } |
Screenshot: Get the additional params at the server side
|
|
Please get back to us if you need further assistance.
Regards,
Rajapandiyan S
hello,
It works,
thanks
Hi Roberto,
We are happy to hear that you have achieved your requirement with the solution provided.
Please get back to us if you need further assistance.
Regards,
Rajapandiyan S