Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Add current rows in Grid to transaction log
posted

I have a form with textboxes and a couple of grids that I need to send to the server to update an XML file with. If a user decides not to update the grids I still need to pass the current values in the grid so that the data in the XML file doesn't get set to blank. I am able to add any unedited row to the transaction log but when this is passed to the server I don't see the row identifier like i do when i am editing a row.

Edited Row: [{"type":"row","tid":"ddb5","row":{"ProgramCode":"WIN","ProcessingCode":"T05","PermitNumber":"CA-I-43851","ExemptionCode":"TTBEX1","B7_PK":"8199d268-74a9-4ba3-92e7-e1ed18609fd3"},"rowId":"8199d268-74a9-4ba3-92e7-e1ed18609fd3"}] 

Non Editied Row: [{"primaryKey":0,"B7_PK":"5b59186b-280f-4d3a-bce8-ea9828c62403","ProgramCode":"FOO","ProcessingCode":"PRO","ProductCode":"32BCP02","Description":"RED WINE/CHIANTI","ProductCountry":"","FDAImporter":"CONWIN01","FDAImporterAddress":"235 N BLOOMFIELD RD","IntendedUseCode":"210.000","PNConfirmationNumber":"","FDAShipper":"RUFSRL02","FDAShipperAddress":"VIA CORSICA 10"}]

All i get is the data from the datasource. This is what I am doing to add the row to the transaction log:

var ds = $("#gridPGAFDA").data().igGrid.dataSource;
var rowObject = $("#gridPGAFDA").igGrid("findRecordByKey", 0);
ds._addTransaction(rowObject);

  • 5513
    Offline posted

    Hello Arden,

    I am sorry for the late reply!

    There is another function in the data source that could help you get the exact same transaction structure that you get from using e.g. Updating. In this way your server side should recognize it correctly as well.

    Try the following:

    var ds = $("#gridPGAFDA").data().igGrid.dataSource;

    var rowObject = ds.findRecordByKey(0);

    var transaction = ds._createRowTransaction(0, rowObject); // the first parameter is the PK

    ds._addTransaction(transaction);

    I hope this helps! Please, let me know if you have any other issues or concerns!

    Best regards,

    Stamen Stoychev