Change order in DDX Form

Hi,

I'm using the DDX Form and I have built the layout I require, however when entries are added to the form, they populate at the bottom of the form. Is it possible to reverse this, so the new entries in the form are at the top? What do I need to edit in the code?

Thanks!

Tagged:

Best Answer

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    The code is appending each record to the end. If you want to change it to add them to the beginning you need to use prepend:

    $table.find('tbody').append($row);
    

    Becomes

    $table.find('tbody').prepend($row);
    

    in the addRow function (originally around line 198)

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**

Answers

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    The code is appending each record to the end. If you want to change it to add them to the beginning you need to use prepend:

    $table.find('tbody').append($row);
    

    Becomes

    $table.find('tbody').prepend($row);
    

    in the addRow function (originally around line 198)

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • Thanks so much!!