The “External HTML” feature described on the agility.js homepage seemed interesting, especially given how terrible JS is at the multi-line strings needed for any but the simplest view.format
structures. But for the life of me I could not get the example to work.
But I eventually cracked the code! For anyone else struggling to get what it says in the docs to work, here was my fix. Instead of:
format: $('#my-format').html(),
you need:
format: $.parseHTML($("#my-format").html()),
I’ve confirmed this works with Agility.js 0.1.3
and either jQuery 1.9.1
and jQuery 2.0.0
.
My understanding is that Agility was tested with jQuery 1.6.1
; this may simply be one of those things where jQuery
subtly changed its behavior over the last 18 months.