Timeago and jQuery dataTables -
using datatables , timeago. dates not showing on next pages when click on next page. code solved it.
$("#simpledatatable_paginate").click(function(){ jquery("abbr.timeago").timeago(); });
however, when clicked on table headings sort
or show pages 10, 20, 25, 50, 100 etc
, search
in datatables data data not displayed. there other way solve this?
i suggest take advantage of draw.dt
event. called every time datatables instance redrawn, i.e when sorting, filtering, changing page etc. create handler before initialize datatable (i assume table id #simpledatatable
) :
$("#simpledatatable").on('draw.dt', function() { jquery("abbr.timeago").timeago(); }); $("#simpledatatable").datatable({ ... });
now can skip other timeago()
calls. problem jquery("abbr.timeago").timeago();
targets present or visible abbr.timeago
elements, not injected later on when sorting, changing page etc.
Comments
Post a Comment