SearchPanes Sort Total
SearchPanes Sort Total
joseoliveiraborlas
Posts: 80Questions: 8Answers: 3
After approximately 80 pages on this forum, I was unable to find information about: how (if possible) to organize/sort automaticly a searchPanes panel with the {total} or {found} of results, instead of the title. It's possible? If yes, where is this information provided?
It's like when you click on sort icon, bujt i dont have buttons, i want sort auto in inicialization
I leave an image to illustrate my bad English!
Answers
Try using the
searchPanes.dtOpts
property to set the ordering for the pane's DataTable to be on the second column:Allan
Hello. Thanks for the response. But it doesn't change anything, I tried it on all panels and it doesn't make any changes, whether asc or desc.
Each searchPane is a separate Datable with only two columns. You are specifying more than two columns with this:
To apply to all searchPanes add
order: [[1, 'asc']]
to yoursearchPanes.dtOpts
section starting in line 21. You are probably getting a Javascript error in the browser's console due to specifying columns that don't exists, ie[2, 'asc'], [3, 'asc'], [4, 'asc'], [5, 'asc']
.For example:
https://live.datatables.net/feqalori/1/edit
However if you want to use
columns.searchPanes.dtOpts
then useorder: [[1, 'asc']]`` only. For example:
https://live.datatables.net/feqalori/1/edit
Kevin
Hi Kevin,
Do you have the second example? The URL as the same as first.
Sorry about that:
https://live.datatables.net/feqalori/4/edit
Its similar to the example in the
columns.searchPanes.dtOpts
docs. Set thecolumns.targets
to the appropriate setting. Basically remove theorder
option you have and replace withorder: [[1, 'asc']]
.Kevin
I can't make it work. Nothing changes with 'order'.
Maybe it's incompatible with 'orthogonal'? Or something conflicting?
I don't know why I need all this code, repeating sometimes, but it's working this way. If I remove something in columnDefs or searchPanes, something goes wrong. I really never understood the differences between the two manners.
Here is an example showing it working: https://live.datatables.net/cijudeqa/1/edit .
Maybe just move the
order
fromdtOpts
into the global SearchPanesdtOpts
so it applies to all panes?Allan
The
searchPanes
option provides configuration options that affect all the searchPanes. Usingcolumns.searchPanes
, ie incolumnDefs
, allows for configuring searchPanes options specific to one or more columns defined bycolumnDefs.targets
.Using
targets: "_all"
will apply to all searchPanes columns. Any SearchPanes config options defined incolumns.searchPanes
will override the options configured insearchPanes
. Anything under thetargets: "_all"
should just go in the main-optino searchPanes
option. Like this:https://live.datatables.net/cutopese/1/edit
For the
order: [ [1, 'asc'] ]
option you havetargets: [4]
but you aren't displaying column 4 according to thecolumns: [2, 3, 5, 6],
setting. I changed my example to use column 2, the Office column. This index represents the table column displayed by the SearchPane not the SearchPane itself.Kevin
This code doesn't appear to do anything, anywhere. Regardless of where I put it and the information I put, it doesn't change the SearchPanes at all.
I'm using 'orthogonal', I've already tried deactivating it.
language: { searchPanes: { count: '{shown}', countFiltered: '{shown}' }}
I already removed it too.
In data I am using for example:
I can even put
order: [ [8465145, 'asc'] ]
and it never gives an error. It gives the feeling that you are not even assuming.Hi kthorngren,
I reduced my code to:
This dont order anything in SP:
Are you using server-side processing? That's rather an important point here... My example shows that it can and does work, but that is client-side processing.
Allan
No, I'm not using server-side. But I've tried server-side, and it still doesn't change anything in the 'order'. Any idea more?
I would like to take this opportunity to ask, if I use serverside I won't be able to customize the panes information, right? For example, as HTML to customize, like the attached image.
Ordering by the aggregation count won't work with server-side processing enabled - not without changing the server-side libraries we provide anyway.
Assuming you want to peruse this, I'd need a link to a page showing the issue, since the example I linked to appears to be working well.
Allan
Hello. By 'customize' I meant using orthogonal data like the imagem example. If it's possible, I'll forget this matter and move on to the server side first.