Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82254

Custom edit to edit record and creat

$
0
0

Description of problem:
Hi, I'm using .NET Editor 1.9.2
I need to create a custom edit button: this button must do
1. update one column for the selected row
2. open modal to edit row
3. create a new record in DB; data source is modal (point 2) whitout delete the selected row

I try to do my goal with this example:
* Customised Control Button example to update one column for the selected row
* Duplicate Button to open modal (for the new value) and to create record in DB

This is the code: it's update the desiderata colum, it's open the desiderata modal BUT when I click 'Update' modal button it's insert the new row AND delete the selected row

{
    extend: "selectedSingle",
    text: "Duplicate",
    action: function (e, dt, node, config) {

        editor
            // Spengo quella che devo modificare
            .edit(main_table.row({ selected: true }).index(), false)
            .set('valid_to', (new Date()).toISOString().split('T')[0])
            .submit();

        editor
            // Creo il nuovo record
            .edit(main_table.row({ selected: true }).index(), {
                title: 'Edit entry',
                buttons: 'Update'
            })
            .mode('create');
    }
}

Where is my error?
Thanks


Viewing all articles
Browse latest Browse all 82254

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>