Dynamicaly selecting data to display in datatables
Dynamicaly selecting data to display in datatables
Krawcu
Posts: 3Questions: 0Answers: 0
Hello all,
I'm fairly new to datatables but amazed by this great plug-in.
I'm stuck with customization and have no idea how to get further. I've search for solution on forum but couldn't find it.
I would like give the user a possibility to select which data will be displayed in datatables - for example, there are few select lists and each value refers to other data's like name, adress, telephone number etc. By selecting option value, user specifies which data's will be downloaded from MySql database. I've tried to load all records and to filter columns by Colvis plug-in, but this significantly slows down webpage, so the best way is to allow the selection and pass necessary data using ajax. Unfortunately, I'm not jquery expert.
Every help would be appreciated, thank you in advance.
I'm fairly new to datatables but amazed by this great plug-in.
I'm stuck with customization and have no idea how to get further. I've search for solution on forum but couldn't find it.
I would like give the user a possibility to select which data will be displayed in datatables - for example, there are few select lists and each value refers to other data's like name, adress, telephone number etc. By selecting option value, user specifies which data's will be downloaded from MySql database. I've tried to load all records and to filter columns by Colvis plug-in, but this significantly slows down webpage, so the best way is to allow the selection and pass necessary data using ajax. Unfortunately, I'm not jquery expert.
Every help would be appreciated, thank you in advance.
This discussion has been closed.
Replies
This discussion is where I explored the same issue and documented the solution:
http://datatables.net/forums/discussion/8074/scroll-datatable-to-bottom#Item_6
Thank you Taylor514ce, that was fast :)
Forgive my ignorance, but like i sad i'm not a jquery expert - but still learning.
If i understood correctly, using the code in link you provided i'll have to replace "sAjaxSource": '/htmlFiles/log.txt', with for example "getdata.php" in which i have to specify a query to database.
next, for each in select list I will have to set its value param which will correspond to specific column in database. By selecting an option, an ajax code will be called. Is that correct?
Thank you in advance.
Then, you'll wire the onchange() event of your select list to call that function, passing in the URL to that table in your call. (In my example, I reload by calling SetInterval, to go get new data ever 3.5 seconds.)
You helped me a lot - now i should figure it out how to deal with my case.
Once again thank you, million times.