Editor: Duplicate button not working

Editor: Duplicate button not working

safaviasafavia Posts: 36Questions: 14Answers: 0

Hello friends,
I ran the editors samples application and the Duplicate button in it works perfectly. However, I tried to replicate the code in my application, all buttons work except the Duplicate button. The only difference I can think of between my application and editor's samples application is that I'm trying to duplicate row from only one table, but the samples application has a join function in it involving two tables.

The other thing I noticed "e, dt, node, config" in my application are shown grey, but in the samples application which works perfectly those are white. should I configure "e, dt, node, config" somewhere?

Thanks so much!
Alan

This question has an accepted answers - jump to answer

Answers

  • safaviasafavia Posts: 36Questions: 14Answers: 0

    One more thing... In my application, when I hover the mouse pointer on the grey code "e, dt, node, config", it says the parameter is declared but never read. I don't get this msg when I hover on the editors samples application which works without problem...

    Cheers,
    Alan

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    I think you should be getting a console syntax error. What is that "excel" doing in your code?

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    The other thing I noticed "e, dt, node, config" in my application are shown grey, but in the samples application which works perfectly those are white. should I configure "e, dt, node, config" somewhere?

    That's just your editor noting that you aren't actually using those variables in the function. You could safely not define them in the function header if you aren't using them.

    Regarding the duplicate not working, I'd need a test case showing the issue if it is working in the demo but not on your page. Also it would be worth updating to the latest version of Editor is you haven't already. I think that example required at least 1.7.

    Finally to the excel string - that should be okay. It would just show the excel export button if you've got the HTML5 button types loaded.

    Allan

  • safaviasafavia Posts: 36Questions: 14Answers: 0

    Well, I updated editor to 1.8.
    The debugger says table is 'undefined' when I click on duplicate button...
    All other buttons work perfectly though (Create, Edit, Remove, Export to Excel)

    Cheers,
    Alan

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    The example works:
    https://editor.datatables.net/examples/api/duplicateButton.html

    Looks the same as your code. Without seeing your code in action, a test csase like Allan requested, its hard to say.

    Maybe a silly question but are you assigning table to the Datatables API like in line 24 of the example?

    Kevin

  • safaviasafavia Posts: 36Questions: 14Answers: 0

    Hi Allan and Kevin,
    Thanks for your help. Attached files are the actual codes.

    Cheers,
    Alan

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    I mioght be missing it but I don't see anywhere that you are assigning the variable table to the Datatables API. I . see this in your code:

                $('#example').DataTable({
                    fixedHeader: true,
    

    Take a look at line 24 of the example and you will see what I'm referring to.

    Kevin

  • safaviasafavia Posts: 36Questions: 14Answers: 0

    Hi Kevin,
    Thanks for your comments. The table is configured through ajax: "/api/waferitems" (line 32). Please note that the create, edit and remove buttons are working perfectly under the same code (only the duplicate button is not working). Should I assign table variable for the duplicate button separately?

    Thanks again.
    Alan

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    Answer ✓

    All you should need to do is assign the table variable when initialing Datatables. FOr example line 88 of your code change to this:

    var table = $('#example').DataTable({
        fixedHeader: true,
    

    Kevin

  • safaviasafavia Posts: 36Questions: 14Answers: 0

    Thanks so much, Kevin! That worked! You saved me!

    Cheers,
    Alan

This discussion has been closed.