Table expands after calling a func.
Table expands after calling a func.
Please make that the login lasts longer! just lostm y thread.
So my tables expands like that http://img21.imageshack.us/i/tblafter.png/
http://img26.imageshack.us/i/tblnormal.png/
when clicking on the button or the dropwdown. i think i did something wrong with the sDom. http://pastebin.org/1111752
Whats wrong?
notice that the function get Table does work the first time @ document ready
So my tables expands like that http://img21.imageshack.us/i/tblafter.png/
http://img26.imageshack.us/i/tblnormal.png/
when clicking on the button or the dropwdown. i think i did something wrong with the sDom. http://pastebin.org/1111752
Whats wrong?
notice that the function get Table does work the first time @ document ready
This discussion has been closed.
Replies
Allan
Ehm, yeahm. I will upload it and post it here. I think it is some very stupid basic thing, since im quite new to everything. :)
Thanks,
Allan
Here my Scripts:
Index.php : http://pastebin.org/1146592
drinks.php: http://pastebin.org/1146577
at drinks, i copied the table html stuff first. then i copied the DrinkGetJSON.php file. then i copied my gettable function and the document ready. so that worked nicely. my table is shown like it should. then i added a button, my deleting scripts and the function to call at drinks.php. i did that, first, without a callback. So i checked somethign, deleted it, refreshed, and it was deleted. so i added getTable() tothe callback, and voila, i got a fat table. ^^
At the beginning i had it the other way round, like the table went not in the width but in the length. that was because i forgot about 4 colums at thee footer.
in the past, it worked fine. and i did it like that. hmm. it looks like he doesnt destroy the table.
try to call getTable twice at the same time, you get that. so i thougth i could empty the otable variable, but that didnt help.
since im a very newbie, i could easylie done a stupid logical mistake.
hope that helps you.
The issue is basically with the table being destroyed and the hidden columns. When DataTables destroys the table, it will set any hidden column back to being visible (since that is how they would be without DataTables). The issue there is that you've got quite a lot of column, and the don't fit into the space available - hence the overflow. Then when the table re-initialises it thinks that the full width is available - so it uses that.
So... what I've done in the file you linked to (which you are welcome to take a copy of), is to simply set the table back to width 100% when destroy is called. It's not perfect, and it will need some improvement before I commit it to the tree, but it will certainly work in this situation.
However, is there any need to destroy the table? It doesn't look like you are changing any of the parameters - you could just call fnDraw.
That's for settings this up to let me debug it!
Allan
Allan
oh and should my uploaded version work correctly? ^^ since it's connected to your file. and btw i got it installed on a extern suse. i get the json from a php file. im rigth with not using serverside, rigth? since i doesnt have that much of data i can handle it on the client.
For the fnDraw - sorry I had thought you were using server-side processing, but from your links above it doesn't look like it - it's just an Ajax source. So when happens, is that you send an Ajax call to the server to update data, and you want the table to then reload and have it show the new data?
The way to reload data is with this plug-in: http://datatables.net/plug-ins/api#fnReloadAjax . Or alternatively, the destroy that you were doing would work as well (just keep using that version of DataTables I put up - from your own server ;-) ). I'll include a fix for the width issue in 1.7.3.
Allan
Thanks a lot for all the Help. But since im new to datatables and js and all that stuff, i need some more help. :) I just Added the AjaxReload Plug In. But it doesnt work in the $.post callback, why? It does work if i use it with a button to manualyl refresh the table. The function has its object when i call it.
http://pastebin.org/1227646
Allan
thanks a lot! for all the help and making such a great plugin. =)
if i would have some spare money i would give you some. someday.