I am trying to pre-configure the order of the columns so that I can organize services by grouping them in sequential order, so I started by hardcoding the order but doesnt seem to work.
/****** REORDERING TESTING ****/
initComplete: function () {
var api = this.api();
new $.fn.dataTable.ColReorder( api, {
order: [ 4, 3, 2, 1, 0, 5,6,7,8 ]
// options
} );
api.columns().invalidate().draw();
}
/***************************************/
ultimately I want to automate this so, I am passing the order through services using a key "order":4 so that I can then somehow use the value from this key to pass to the order option.
You'd need to pluck the order parameter from that array of objects and make an array.
One thing I'm not clear on though - do you need to use ColReorder? Could you not put the columns in the correct order without using ColReorder? It would be so much faster. E.g. just sort your services array by that parameter before passing it to DataTables.
Also, in your example your order array for ColReorder doesn't define all columns - it must be the same length as the number of columns in the table. I'd still recommend just sorting the array first though.
Ah, thats a good idea al, thanks Im working on it.
By the way, quick question on performance, the webapp im building will be loading 100k records, and right now im testing on just 400 records and notice a huge performance hit on filtering the records.
Any idea what may be causing this, or how to improve it, here is a recording I made https://somup.com/c0VFFzxobh
It really shouldn't be noticeably slow with just 400 rows. 100k would crush it!
Are you using server-side processing? You'll need to (with paging enabled) if you are going to have 100k records. Also the viewTotal / viewCount / cascade options in SearchPanes really slow things down, particularly when server-side processing is enabled.
So I replicated some records (1k in total) and services in the dev mock example, and I can definately see performance issues whilst interacting with the filters, how does one troubleshoot at which point is the bottleneck ocuring? perhaps applying functions to the columns or something else?
Furhermore, I tried the search filter with those 1k records and it freezes when I type a single character, I ended up removing on another dev test case the functions applied to the columns and rows to render the toggle buttons and other bits, and did not notice any improvement, so the issue seems to lie when filtering, but I don't know what can be done.
Answers
Your test case is working:
Your screenshot shows
fixedColumns: {left:1},
not left: 5 as you code snippet depicts and what is configured in the test case.Kevin
Hi @kthorngren
I created a function to render the name in a different colour if the blackList key is either 0 or 1, however, only 1 colour is being returned.
http://live.datatables.net/nubafowe/2/edit
using one
=
is not a comparison but sets a value. You need to use either==
or===
for comparisons. See this tutorial.Kevin
ah indeed, is working now! thanks for the pointer.
Hi @kthorngren @allan
I am trying to pre-configure the order of the columns so that I can organize services by grouping them in sequential order, so I started by hardcoding the order but doesnt seem to work.
http://live.datatables.net/muzeriza/1/edit
I've tried
and also on subscription button click
as well as on completion but I can't make it work
ultimately I want to automate this so, I am passing the order through services using a key "order":4 so that I can then somehow use the value from this key to pass to the order option.
You'd need to pluck the
order
parameter from that array of objects and make an array.One thing I'm not clear on though - do you need to use ColReorder? Could you not put the columns in the correct order without using ColReorder? It would be so much faster. E.g. just sort your
services
array by that parameter before passing it to DataTables.Also, in your example your
order
array for ColReorder doesn't define all columns - it must be the same length as the number of columns in the table. I'd still recommend just sorting the array first though.Allan
Ah, thats a good idea al, thanks Im working on it.
By the way, quick question on performance, the webapp im building will be loading 100k records, and right now im testing on just 400 records and notice a huge performance hit on filtering the records.
Any idea what may be causing this, or how to improve it, here is a recording I made https://somup.com/c0VFFzxobh
It really shouldn't be noticeably slow with just 400 rows. 100k would crush it!
Are you using server-side processing? You'll need to (with paging enabled) if you are going to have 100k records. Also the viewTotal / viewCount / cascade options in SearchPanes really slow things down, particularly when server-side processing is enabled.
Allan
Hi @allan @kthorngren
So I replicated some records (1k in total) and services in the dev mock example, and I can definately see performance issues whilst interacting with the filters, how does one troubleshoot at which point is the bottleneck ocuring? perhaps applying functions to the columns or something else?
https://live.datatables.net/muzeriza/2/edit
Furhermore, I tried the search filter with those 1k records and it freezes when I type a single character, I ended up removing on another dev test case the functions applied to the columns and rows to render the toggle buttons and other bits, and did not notice any improvement, so the issue seems to lie when filtering, but I don't know what can be done.
@colin for visability
On your example 50k performance page, you can also see how the filter lags for too many seconds before it filters the data out
https://datatables.net/extensions/searchpanes/examples/performance/cascadeViewTotal50k.html
I've loaded only 15 records and it shows the slugish performance of the filters,
Please see here recording https://somup.com/c0nbbZxWBg