Load Vexflow with AJAX

165 views
Skip to first unread message

Greg

unread,
Dec 27, 2010, 4:55:36 PM12/27/10
to vexflow
I want to load a vexflow tab after page load with AJAX. Is there a
function I can call to evaluate the content of the vexflow div tag
(<div id ="tab" class="vex-tabdiv"></div>) so it renders as guitar
tab? Right now, after I load the vexflow tab with AJAX I reload the
vextabdiv.js and vexflow.js scripts with the jQuery .getScript()
function and it works but it is pretty slow. Is there a specific
vexflow function I can call instead?

example code:

$('#tab').append(tab);
$.getScript("tabdiv/vexflow-free.js");
$.getScript("tabdiv/vextabdiv-free.js");

Full code here:
http://code.gregjopa.com/gregjopa/code/html5/audio/tabplayer/index.html

Thanks,

Greg

Mohit Muthanna

unread,
Dec 27, 2010, 5:02:42 PM12/27/10
to vex...@googlegroups.com
You can call:

Vex.Flow.TabDiv.SEL = null; // Disable automatic initialization
var tabdiv = new Vex.Flow.TabDiv("#tab"); // Parse, create canvas, and redraw

At any later point, if you update the tab:

tabdiv.redraw(); // reparse and redraw

Mohit.


--
You received this message because you are subscribed to the Google
Groups "vexflow" group.
To post to this group, send email to vex...@googlegroups.com
To unsubscribe from this group, send email to
vexflow+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vexflow?hl=en



--
Mohit Muthanna [mohit (at) muthanna (uhuh) com]

Gregory Jopa

unread,
Dec 27, 2010, 11:13:06 PM12/27/10
to vex...@googlegroups.com
Thanks, this code works great.

Greg

Kurdi Bogdán

unread,
Apr 22, 2017, 9:38:46 AM4/22/17
to vexflow
Hi! I've tried it, but it didn't work for me. I've found another solution:

var tab = [something];                                 // value of the textarea with VexFlow code
$
("#tab textarea[class='editor']").val(tab).keyup();   // insert code into textarea and then fire keyup()

Have a nice day!
Bogdán
Reply all
Reply to author
Forward
0 new messages