Duplicate - click from href link

Duplicate - click from href link

hyklhykl Posts: 48Questions: 19Answers: 5
edited March 2016 in Free community support

I know about Duplicate button, but I want not have button but I want duplicate for click to href link as link to Create New Record - https://editor.datatables.net/examples/simple/inTableControls.html inTableControls I want source code for Duplicate.

Thank you

Replies

  • btreebtree Posts: 99Questions: 14Answers: 11

    Duplicate is no Standalone Plugin it just simple uses "Create New Record" and uses the selected values.

    In your case it would be like this:

     // Duplicate row on click link element with class editor_duplicate
        $('a.editor_duplicate').on('click', function (e) {
            e.preventDefault();
            
            // Place the selected row into edit mode (but hidden),
            // then get the values for all fields in the form
            var values = editor.edit(table.row( { selected: true } ).index(), false ).val();
            // Create a new entry (discarding the previous edit) and
            // set the values from the read values
            editor.create( {title: 'Duplicate record',buttons: 'Create from existing'} ).set( values );
        } );
    

    Cheers
    Hannes

  • hyklhykl Posts: 48Questions: 19Answers: 5

    Hóóóóólááá, I am very happy :-) Thank you very much and thank you for fast time answer :-)

    Tested a it is OK :-)

  • hyklhykl Posts: 48Questions: 19Answers: 5

    Form-Options have type: onEsc - blur, create, edit have no problems but for duplicate link has problem:

    $('a.editor_duplicate').on('click', function (e) {
                        e.preventDefault();
                        var values = editor.edit(table.row({
                            selected: true}).index(), false).val();
                        editor.create({
                            title: 'DUPLICATE THIS RECORD',
                            buttons: 'Create record',
                            onEsc: 'blur'}).set(values);    
                    });
    

    Where is this problem?
    Next: For Delete record has problem too.

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    I'm afraid I don't know what the issue is. You say there is a problem - what is it? Without knowing that I can't really suggest a fix.

    For example, do you get a Javascript error? Or is the server returning an error? Or something else.

    Ideally, a link would be useful so it can be debugged.

    Allan

  • hyklhykl Posts: 48Questions: 19Answers: 5

    I'm sorry, I'm writing you from the beginning:

    When you create a recording or during the editing when I click esc key on the keyboard, it works like that disables automatic shut-off when windows. It's alright.

    Only problem is mainly with reference to the duplicate, and delete the selected record, which does not lock automatically closing when I click esc.

    You understand it?

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    I'm sorry, I still don't quite get it. The esc key doesn't close the form when you have the duplicate form showing? Can you link to a page showing the issue and give me step by step instructions please.

    Allan

This discussion has been closed.