Duplicate click without must to selected

Duplicate click without must to selected

hyklhykl Posts: 48Questions: 19Answers: 5

If it can be done as follows:

               $('a.editor_create').on('click', function (e) {
                    e.preventDefault();
                    editor.create({
                        title: 'CREATE NEW ROW',
                        buttons: 'CREATE',
                        onEsc: 'blur'
                    });
                });
                
                $('#example').on('click', 'a.editor_duplicate', function (e) {
                    e.preventDefault();
                    var values = editor.edit(table.row({
                        selected: true}).index(), false).val();
                    editor.create({
                        title: 'DUPLICATE THIS ROW',
                        buttons: 'DUPLICATE',}).set(values);     
                });
                
                $('#example').on('click', 'a.editor_edit', function (e) {
                    e.preventDefault();
                    editor.edit(
                        $(this).closest('tr'),{
                            title: 'EDIT THIS ROW',
                            buttons: 'UPDATE',
                            onEsc: 'blur'
                        });
                });
                
                $('#example').on('click', 'a.editor_remove', function (e) {
                    e.preventDefault();
                    editor.remove( 
                        $(this).closest('tr'),{
                            title: 'DELETE THIS ROW',
                            message: 'Want to delete?',
                            buttons: 'DELETE'
                        });       
                });

when I click on the create, update, delete, duplicate.

Click the row without the required selection (selected) - click creation without necessarily choosing works without a problem, then work to update and removal.

The problem is that without duplicating the selection does not work.

I want so I clicked without necessarily duplicating row selection, is it possible?

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Could you link to a page showing the issue please? I'm not fully understanding the problem I'm afraid.

    Allan

  • hyklhykl Posts: 48Questions: 19Answers: 5

    Example: I want not on first to click select row and on second click to duplicate.

    I want:

    I want to click to duplicate in row and Editor window is opened.

    You understand?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    To have a double click duplicate a row you could use the Editor API in exactly the same way as my duplicate example, but instead of calling the Editor API methods from the custom button, do it from a jQuery dblclick event handler.

    Keep in mind that you can't have both a click and dblclick event handler on the same element as you can't distinguish between the two.

    Allan

This discussion has been closed.