You are viewing limited content. For full access, please sign in.

Question

Question

Forms Table Sort

asked on December 15, 2016 Show version history

Hi All,

I'm currently trying to re-order a table in forms using the DataTables jQuery plug-in.

https://datatables.net/

It is initializing without any issues and I'm not getting any error messages however it doesn't seem to be able to sort the table. I think that this might be due to the fact that the column values aren't being picked up by the plug-in. Has anyone had any experience using this (or any other plug-in) to order a table in Forms or know of an alternative method?

UPDATE: I've managed to get the table sorted as I was hoping, however when the form is then submitted, on the next user task the ordering has been lost.

If anyone has any ideas it would be much appreciated.

Kind regards,

Ronald Gray

0 0

Replies

replied on December 15, 2016

I'm not sure if keeping the sort order would be possible after submitting the form. There would have to be a way for the form to know what the sort order was to resort the table on load. I am guessing that since this is being done using a 3rd party plug-in, that information is not being passed with the form by default.

0 0
replied on December 15, 2016

Thanks for the reply Blake. Do you have any idea how Forms knows which order the rows in a table should appear?

0 0
replied on December 15, 2016

I would imagine it has some kind of a sort order that is stored in the database when the variable is saved.

0 0
replied on August 20, 2018

Hi Ronald,

I am looking to utilize the datatables plugin as well. Can you share your code on how to implement it?

0 0
replied on August 28, 2018

Hi Tuan,

Please give the below JavaScript below a try.

  $(document).ready(function () {           
$.getScript('https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js', function() {
      $('table').dataTable({
        'searching': false,
        'paging': false,
        'order': [1, 'asc']
      });
})

 

 

0 0
replied on August 28, 2018

it works. thank you

0 0
replied on February 3, 2021

hi Ronald,

I tried below code but it didnt work for me. Can you please let me know where i'm going wrong ? 

$('#ordertable').DataTable({
        'destroy': true,
        'searching': false,
        'paging': false,
        'order': [2, 'asc']
    });

Thank you 

Rajah

0 0
replied on February 11, 2020 Show version history

Hi Ronald,

What did you do to get the DataTables plugin to work as you mention in your Update.  I am having the same trouble where I can see the DataTables is being applied since the arrows and formatting display however, when clicking the sorting arrows nothing happens.  Paging works but Searching doesn't.

So I have a table being populated by a LookUp Rule and the form never actually submits since I am using the form to create more of a display dashboard.  Also, I tried placing the code you have above in a setTimeout function to see if maybe delaying the dataTable application to wait until the LookUp function had completed.

Mahalo,

- Jared :)

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.