Skip to main content

Loading javascript dependecies of custom jMaki widgets

8 replies [Last post]
kjambor
Offline
Joined: 2004-04-19
Points: 0

Hi,

I have created a new textfield jMaki widget that uses SPRY validation library.
I am able to get the widget to work if I include the Javascript/css dependencies directly onto the form that contains my textfield jMaki widget. However, I wanted jMaki to load the libraries rather than always including them on my form.

I tried adding the libraries to my widget's widget.json file as shown below. However, jMaki doesn't seem to want to load them.

'config' : {
'type' :
{ 'id' : 'sbm.textfield',
'libs' : [
'SpryValidationTextField.js'
],
'styles' : [
'SpryValidationTextField.css'
]
}
},

Has anyone been able to do a similar thing before?

Regards,

-- Kamyar

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kjambor
Offline
Joined: 2004-04-19
Points: 0

Changes in widget.json only take effect after webservce restart.

sloanb
Offline
Joined: 2003-09-14
Points: 0

Is it not loading the library at all? If so what errors are you getting?

kjambor
Offline
Joined: 2004-04-19
Points: 0

Hi Sloan,

I am not sure if it is even loading the script or css file. I am not getting any errors.
I am using Firefox with firebug.

Regards,

-- Kamyar

sloanb
Offline
Joined: 2003-09-14
Points: 0

If you have firebug installed you should be able to see if they are being loaded. Any way you could post some code or possible email me?

kjambor
Offline
Joined: 2004-04-19
Points: 0

Hi Sloan,

I have firebug and console tab does not show my js file being loaded and I am not seeing any errors. So, it seems like the config entry in the widget.json file is being ignored. I am not sure how to debug this issue any further.

Would you like me to send you my widget code? If you have the patience, send me your email address, and I will send it to you.

Regards,

-- Kamyar

sloanb
Offline
Joined: 2003-09-14
Points: 0

Kamyar,

I would be happy to look over your code. Just send it to {email}
Regards,
--Sloan

kjambor
Offline
Joined: 2004-04-19
Points: 0

Hi Slaon,

Never mind. I figured it out.
If I restart my webserver, then my widget is loading the js and css files as specified in the config parameter of widget.json.

But the issue is that if you change config entries in the widget.json, you MUST restart your webserver for changes to take effect.

Regards,

-- Kamyar

sloanb
Offline
Joined: 2003-09-14
Points: 0

Good deal let me know if you need anything else.

--SB