Does the dtOpts work on server side search panes

Does the dtOpts work on server side search panes

sarooptrivedisarooptrivedi Posts: 59Questions: 18Answers: 2

**https://datatables.net/forums/discussion/78108/searchpanes-sort-total**:

Is the dtOpts work with server side search Panes ?

 {
     searchPanes: {
         dtOpts: {
             order: [[7, 'desc']]
         }
     },
     targets:[7],

 },

Replies

  • kthorngrenkthorngren Posts: 21,188Questions: 26Answers: 4,925

    The columns.searchPanes.dtOpts option applies to the Datatable built by SearchPanes. There are only two columns in the table. Using order: [[7, 'desc']] won't work since there are 8 columns in the table.

    What are you trying to do?

    Allan stated this about sorting by the total in the thread you linked:

    Ordering by the aggregation count won't work with server-side processing enabled - not without changing the server-side libraries we provide anyway.

    Kevin

  • sarooptrivedisarooptrivedi Posts: 59Questions: 18Answers: 2

    My custom table has 10 fields I am just reference the old question link here.

  • allanallan Posts: 63,262Questions: 1Answers: 10,423 Site admin

    Yes, dtOpts will pass through to the child table for the search pane. However, depending on what it is you want to do, might be limited by how SearchPanes operates. It depends what you want to do, which you haven't answered Kevin's question about.

    As Kevin says, the SearchPane tables only have two columns, so telling it to order by column index 7 isn't going to work.

    Allan

  • sarooptrivedisarooptrivedi Posts: 59Questions: 18Answers: 2

    Aha,

    Now I understand little bit this function. you mean that SearchPane has only two columns for label and total. so, we need to specify the values either 0 or 1

        dtOpts: {
                order: [[0, 'desc']]
            }
    
  • sarooptrivedisarooptrivedi Posts: 59Questions: 18Answers: 2
    edited June 24

    I needs to order the Year in desc order while open the SearchPanes . I want to show the current year on first (descending order)

     {
         searchPanes: {
             show: true,
             dtOpts: {
                 info: true,
                 order: [[1, 'desc']]
             },
             preSelect: [
                 {
                     column: 7,
                     rows: [(new Date().getFullYear()).toString()]
                 }
             ],
         },
         targets: [2,7]
     },
    
  • allanallan Posts: 63,262Questions: 1Answers: 10,423 Site admin
    order: [[0, 'desc']]
    

    I think.

    If that doesn't work, please link to a test case showing the issue.

    Allan

  • sarooptrivedisarooptrivedi Posts: 59Questions: 18Answers: 2
      {
          data: 'Year', "name": "Year", "autoWidth": true, orderSequence: ['desc', 'asc'], 
          render:function(data) {
              return data;
          }, searchPanes: {
              show: true, orthogonal: 'sp', dtOpts: {
                  order: [[0, 'desc']]
              }, } },
    

    I figure out it is worked on column level

Sign In or Register to comment.