Duplicate row problem

Duplicate row problem

LTom93LTom93 Posts: 13Questions: 2Answers: 0

Hello,

I'm using your duplicate row function and I got a bug there.
When I select a row and click on the duplicate button it opens the dialog as edit mode, after I click again on the duplicate button(while the current row is still selected) it works... it opens the dialog as duplicate mode. If I select other row the bug reproduces.
*** The duplicate button calls Split Lines ***
How can I fix it?

The link to the editor table is:
http://www.orders.tomluz.co.il
You need to login first, details:
Username: Admin
Password: 123456
The link to the JS file(handling the editor script):
http://www.orders.tomluz.co.il/cs/editor/custom/orders.js

Thanks.

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Hi,

    Thanks for the link. Could you confirm the exact steps in order to reproduce the error please? I've tried:

    1. Select row 111815-1 by clicking on its id
    2. Click the Split lines button
    3. Close the Editor modal that is shown
    4. Click the Edit button - appears to work as expected.

    I've also tried:

    1. Select row 111815-1 by clicking on its id
    2. Click the Split lines button
    3. Close the Editor modal that is shown
    4. Select a different row (111815-2)
    5. Click the Edit button - appears to work as expected.

    Allan

  • LTom93LTom93 Posts: 13Questions: 2Answers: 0
    edited December 2015

    Hello,

    You didn't understand me. I'll explain:

    1. Select a row(which one you want), for example I've selected 111815-1.
    2. Click on split lines button to duplicate the row, after the modal is shown, click on the button split lines to duplicate the row.
    3. Nothing happens... It doesn't duplicate the row. After I checked few times, I have figured it out... at the first time it opens as edit mode, it edits the row, but doesn't duplicate it.
    4. After I click again on split line button without unselecing the row, it opens again but this time after I click on split line button, it duplicates the row.

    Do you understand me now?

  • LTom93LTom93 Posts: 13Questions: 2Answers: 0

    Don't click on the edit button.. I don't talk on this button. I'm talking about the behavior of the split lines button(duplicate function).

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    It looks to me like it did add the duplicated row. I do:

    1. Load page
    2. Select row 111815-1
    3. Click the "Split lines" button
    4. Click the submit button in the Editor form
    5. The table is redrawn with the newly created row (which is shown at the very end of the table) - I presume that the PO-NO is being generated automatically at the server-side?

    Allan

  • LTom93LTom93 Posts: 13Questions: 2Answers: 0

    Unfortunately, it's a bug in your plugin.
    When you select the row from a cell it opens the inline editing. when the inline editing is open and you are trying to click on duplicate button("Split Lines") it opens the dialog as Edit mode...
    To fix it -> Just wrap the function with setTimeout:

                                    setTimeout(function(){
                                        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: 'Split Line',
                                                buttons: 'Split Line'
                                            } )
                                            .set( values );
    
                                        setTimeout(function(){
                                            $('.DTE_Body_Content').scrollTop(0);
                                            $('#DTE_Field_orders-pairs_per_carton').trigger("click");
                                        }, 50);
                                    }, 100);
    
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Hi,

    Yes, unfortunately this is a bug in the duplicate button example if used with inline editing active. It does currently need a setTimeout to operate correctly. I'll will correct this in a future update.

    Allan

This discussion has been closed.