I am using the SetupJavascriptFramework the code of two frameworks, namely jQuery and W2UI. The respective source code is stored in a constant each, I am using this code:

[code]Function SetupJavascriptFramework() As String
dim src() as string

src.append jQuery
src.append W2UIJS

return join(src, EndOfLine)
End Function

Though, it does not seem to be added to the page source code, can’t find the Javascript code anywhere. Where do I need to look?

The respective area in framework.js is empty…

[code]/* BEGIN: SDK */

/* END: SDK */[/code]

Are your libraries modified in any way? If not, they’re going out of scope as soon as they reach the page. When items are executed in this way, they must be placed into your namespace if you want them to persist.

I suggest loading each library into a WebFile and then using LoadLibraries to pull them from the server.

I did that now. They are now being included in the html header. So good, so far. But they still don’t work. Do I need to use the callback parameter with LoadLibraries? I left it empty for the moment.

I reconstructed the very simple get startet example both in an html file and Xojo project (using the wrapper class). In the plain html file, everything works as expected. Within Xojo, it doesn’t - though the source code in Chrome’s inspector looks okay.

I know that “not working” is a worse error description - but since nothing happens really (yes, I set visibility) and the lack of JS/html debugging capabilities, I am having a hard time debugging…

Edit: Maybe that is helping… Console of Chrome:

Remember that LoadLibraries is asynchronous. If you are calling LoadLibraries and then trying to execute that code immediately afterward using ExecuteJavascript, you’ll have problems. What you could do is create a custom event that gets triggered from the callback to let you know when your libraries have been loaded.

Oh okay. I’ll get that done. However, when I used the SetupJavascriptFramework event it didn’t work either. But that might be because SetupHTML gets called before that event.

Got a step further, yay. Now another issue regarding scope probably:

In the SetupJavascriptFramework event I send this piece of code to the browser:

[code]XojoCustom.MyNamespace.id_libraryLoaded = function () {
$(function () {{
name: ‘id’,
header: ‘List of Names’,
columns: [
{ field: ‘fname’, caption: ‘First Name’, size: ‘30%’ },
{ field: ‘lname’, caption: ‘Last Name’, size: ‘30%’ },
{ field: ‘email’, caption: ‘Email’, size: ‘40%’ },
{ field: ‘sdate’, caption: ‘Start Date’, size: ‘120px’ },
records: [
{ recid: 1, fname: “Peter”, lname: “Jeremia”, email: ‘’, sdate: ‘2/1/2010’ },
{ recid: 2, fname: “Bruce”, lname: “Wilkerson”, email: ‘’, sdate: ‘6/1/2010’ },
{ recid: 3, fname: “John”, lname: “McAlister”, email: ‘’, sdate: ‘1/16/2010’ },
{ recid: 4, fname: “Ravi”, lname: “Zacharies”, email: ‘’, sdate: ‘3/13/2007’ },
{ recid: 5, fname: “William”, lname: “Dembski”, email: ‘’, sdate: ‘9/30/2011’ },
{ recid: 6, fname: “David”, lname: “Peterson”, email: ‘’, sdate: ‘4/5/2010’ }
});’*’, function (target, eventData) {
Xojo.triggerServerEvent(“id”, eventData.type, JSON.stringify(eventData));

id is being replaced by the control’s id. The function _libraryLoaded is the callback method called by LoadLibraries. Still I get the message: "Uncaught TypeError: Cannot call method ‘w2grid’ of undefined ". Is this still not persistent and already went out of scope?

for me it’s working so your probably doing something wrong.
It’s very complicated to work with the WebSDK in the beginning. Once you get the hang of it, then it becomes somewhat easier.

Why do you replace id with the control id?
I dont think that’s needed.

I just use some framework like:

XojoCustom.swort = {
libsloaded: function(){
// do some actions
action: function(){
// do some actions

@Alex von Siebenthal
It looks like you’re defining your item as:


but then somewhere in your code, when you call the method


The object part of the call is undefined: XojoCustom.MyNamespace.asfewcd

hence the error: "Uncaught TypeError: Cannot call method ‘w2grid’ of undefined "

Argh. The most obvious mistakes are the ones I never spot. Thanks Greg.