Marking a row for deletion

Marking a row for deletion

GeorgeHelmkeGeorgeHelmke Posts: 44Questions: 16Answers: 0
edited December 2014 in Priority support

I have an editor/table working client side. I want to mark records for deletion, and then when the whole thing is sent to the server, it sorts out what is to be deleted.

  $('#DistributionAddressTable tbody ').on('click', 'button', function (event) {
        var row = $(this).closest("tr").get(0);
        console.log(row);
        var aData = DistributionAddressTable.row(row).data();
          if (this.name == "DeleteRecord") {
            aData.Source = "DELETE";
        }
        event.stopImmediatePropagation();  //prvents the other on click from firing that fires up the inline editor
    });

But this isn't updating in the editor - you do not see the change. What can I do different?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Hi George,

    What you say it isn't updating in the editor - what exactly are you expecting to happen here? Do you have a Editor form that makes use of the Source field and it isn't displaying DELETE (which is should if that is the case)?

    How are you submitting this information to the server? Through a custom Ajax call or through Editor in some way?

    Regards,
    Allan

  • GeorgeHelmkeGeorgeHelmke Posts: 44Questions: 16Answers: 0

    I am sending the local table enmasse over to the server. Works well for edit and create.

    Yes, I am expecting the Source field to display the DELETE text.

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Yes, I am expecting the Source field to display the DELETE text.

    In the table, or the Editor form? In Editor, it should be that the next time you display that record for editing the Source field would indeed show the DELETE text. In DataTables you would likely need to call the row().invalidate() method, or just use row().data() to set the data in the first place.

    Note that all of this is dependent on you not using server-side processing (I'm afraid I can't remember if you are). If you are using SSP, then manipulating the data at the client-side isn't going to do much good, since the next table draw would just wipe out any changes you have made, loading the new data from the server.

    Allan

  • GeorgeHelmkeGeorgeHelmke Posts: 44Questions: 16Answers: 0

    This worked:
    aData.Source = "DELETE";
    AddDistributionAddressTable.rows().invalidate();

This discussion has been closed.