zurb / responsive-tables

Tables that work responsively on small devices.
429 stars 132 forks source link

Break for AJAX Load #7

Open randallmeeker opened 12 years ago

randallmeeker commented 12 years ago

When a responsive table is loaded via an AJAX request it fails to display correctly. I attempt to call 'updateTables' after ajaxComplete, but this does not seem to work either.

ghost commented 12 years ago

+1 does not work with yepnope.js

thm-design commented 11 years ago

If you are talking about the content not being in the "scrollable container" after an ajax call, try calling this when updating content in your ajax implementation, worked for me.

$("table.responsive").each(function(i, element) { splitTable($(element)); });

You may have to make the plugin code and ajax code available to eachother

edbo commented 11 years ago

I did this:

window.redrawTables = function(){
    $("table.responsive").each(function(i, element) { unsplitTable($(element)); });
    $("table.responsive").each(function(i, element) { splitTable($(element)); });
};

Then I can call redrawTables anywhere. A bit ugly bit it works. Really the best solution would be to make this a proper jQuery plugin so that something like:

$('table.responsive').redrawTable()

Or something simliar

gabetax commented 10 years ago

There's currently support for updating the pinned table by calling (the vaguely named) $(window).trigger('redraw'), but it doesn't cleanup the existing pinned tables first.

garethdaine commented 9 years ago

Just came across this issue now. Rather than messing about with running the responsive table functions again (I can't as the plugin is minified using Gulp and Uglify and so don't have access to the functions), it's easier to simply empty the container for the table using:

$('#container').empty();

Before replacing it with your new data. This fixed most issues for me.

kuldeepghildiyal commented 8 years ago

Just fixed the problem by clearing my parent container and calling redraw function after AJAX load. Step 1 : $('#container').empty(); Step 2 : Get the data from Ajax call Step 3 : Bind parent container with the data and table. step 4 : $(window).trigger('redraw'); Step 5 : Done

honoluluman2 commented 6 years ago

kuldeepghildiyal i have run also to the same problem by using a short plugin that i found here https://github.com/danhauk/dm-responsive-tables , could you provide please the code you used so i could fix this? Thank you