euuh, don't know what is Editor PHP libraries, so i don't think i'm using it!!
Before I make any changes, i'm thinking if I should display all list of orders or only from the last X months for example!!
I don't think it's a good practice to load ALL orders, it will just saturate the server :/
and will the pluck() function work well with server side?
I'd like to ask you 2 questions please:
1- as I'm using deferRender, I'm currently querying the database in the main page to get the number of results. But I know i can do it differently by using "footerCallback":
"footerCallback": function(row, data, start, end, display) {var api = this.api();if(api.column(1).data().length) { // wait until datatables rendersvar num_rows = api.page.info().recordsDisplay;$("h1 span.num").html(num_rows);}}
is that the best way to do so?
2- I'd like to use the toggle column function, i found this link: https://datatables.net/examples/api/show_hide.html
I was wondering if the column index must be indexed with numbers: data-column="0" or if I can use class names for example!
Wow, thanks for the very fast reply, i'm always impressed :)
OK, I had a look at ColVis, it looks great!
Is it possible to hide by default some columns?
I have one other little issue, I'm using deferRender, and when no results are found to display, the browser returns the following error: Uncaught TypeError: Cannot read property 'length' of undefined
However when I already have results and search for something that doesnt exists, it says "No matching records found". So the problem is only for the initial display when there is nothing to display!
I would like to be able to search even in the expanded data. Is that possible?
No. The DataTables search uses the column data only. You would need to include the data you want to search in a column (it could be hidden if you don't want it to be visible).
Answers
euuh, don't know what is Editor PHP libraries, so i don't think i'm using it!!
Before I make any changes, i'm thinking if I should display all list of orders or only from the last X months for example!!
I don't think it's a good practice to load ALL orders, it will just saturate the server :/
and will the pluck() function work well with server side?
Hi Allan, how are you?
I'd like to ask you 2 questions please:
1- as I'm using deferRender, I'm currently querying the database in the main page to get the number of results. But I know i can do it differently by using "footerCallback":
"footerCallback": function(row, data, start, end, display) {
var api = this.api();
if(api.column(1).data().length) { // wait until datatables renders
var num_rows = api.page.info().recordsDisplay;
$("h1 span.num").html(num_rows);
}
}
is that the best way to do so?
2- I'd like to use the toggle column function, i found this link: https://datatables.net/examples/api/show_hide.html
I was wondering if the column index must be indexed with numbers: data-column="0" or if I can use class names for example!
Thanks a lot for your help
Reda
1) Using
page.info()
to get the number of records looks fine to me.2) Have a look at ColVis.
Allan
Wow, thanks for the very fast reply, i'm always impressed :)
OK, I had a look at ColVis, it looks great!
Is it possible to hide by default some columns?
I found that i should use bVisible, but all the forums are from 2013 or earlier, is it still up to date?
thanks
Use
columns.visible
.The searchable reference for all options and the API is here.
Allan
OK, Thanks a lot.
Hi Alan, hope you're doing well.
I have one other little issue, I'm using deferRender, and when no results are found to display, the browser returns the following error:
Uncaught TypeError: Cannot read property 'length' of undefined
However when I already have results and search for something that doesnt exists, it says "No matching records found". So the problem is only for the initial display when there is nothing to display!
Do you know how I can fix this?
Please link to a test case showing the issue so I can debug it.
Allan
the links are in an admin page :/ can you please send me you email and i'll email you a test page?
You can PM me by clicking my name above and then the "Send message" button.
Allan
done!
Hi,
I'll have one other request please.
I'd like to be able to expand the rows. i saw this https://datatables.net/examples/api/row_details.html but it's not really what I want!
I would like to be able to search even in the expanded data. Is that possible?
and will it be also possible to do it using deferred data?
thanks
No. The DataTables search uses the column data only. You would need to include the data you want to search in a column (it could be hidden if you don't want it to be visible).
Allan
OK, i'll do that ;)
Thanks again and happy holidays ;)