On 01/27/2015 02:52 AM, Bryn Jeffries wrote: > Is there a "right" way to make a LiveTable refresh? >
I do not know of a "right way", but one that currently works is to fetch the livetable by its name, and refetch the current rows via some not-so obvious code, like: var livetable = window['livetable_'+ id_of_livetable_here ] ; var end = livetable.limit; var start = Math.max(livetable.lastOffset, 1); livetable.clearCache(); livetable.getRows(start, end, start, end); That works in some little extension I wrote: https://github.com/xwiki-contrib/application-reviewpages/blob/master/application-reviewpages-ui/src/main/resources/ReviewPages/Script.xml#L176 I think I even "borrowed" it from some other xwiki-contrib code, but cannot remember from where. Certainly this is not "using any API" and it is expected to break without notice in any new XWiki version, but for now it does the job (for me at least). Sure there is a better way, to do this, (or at least it should ;)) but I do not know about it. > I have a page that includes a LiveTable to show the results of a query on an > external database, and a form triggers an AJAX call to modify the database > (e.g., insert a new row). I'd like the AJAX call to include an action within > OnSuccess to make the LiveTable refresh to show these modifications. > > http://xwiki.475771.n2.nabble.com/Proposal-Hightlight-applied-filters-in-livetable-tp4936097p4942165.html > and > http://jira.xwiki.org/browse/XWIKI-5100 > appear to discuss something of this kind, but I couldn't find any > instructions. The closest thing was a line in livetable.js > https://github.com/xwiki/xwiki-platform/blob/4f92c9fc4dc9d4bb7b42a54f3e289f42e833d986/xwiki-platform-core/xwiki-platform-web/src/main/webapp/resources/js/xwiki/table/livetable.js#L963 > where it looks like a refresh is triggered on event > "xwiki:livetable:mylivetable:filtersChanged". I have tried calling > document.fire('xwiki:livetable:mylivetable:filtersChanged'); > from within a javascript function, but this did not appear to make the > "mylivetable" LiveTable update. Could anyone direct me further? > > Thanks, > > Bryn > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
