Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
hemant19cse
Posts: 101
Registered: ‎11-08-2012
My Device: 9790
My Carrier: Reliance
Accepted Solution

cascades support javascript in the qml file

Does cascades support javascript in the qml file ?? If yes please let me know how to use js in qml file .

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: cascades support javascript in the qml file

Something tells me you might not have started by checking all of the introductory documentation. :-)

 

https://developer.blackberry.com/cascades/documentation/dev/index.html should get you started, in particular the section there entitled "JavaScript in QML".


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
New Developer
hemant19cse
Posts: 101
Registered: ‎11-08-2012
My Device: 9790
My Carrier: Reliance

Re: cascades support javascript in the qml file

I Tried that but it's not working . if you do so , the app itself is not running , saying invalid import identifier .

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: cascades support javascript in the qml file

Please copy and paste specific errors if possible, or screenshots, or snippets of your actual code. Nobody could guess what you're actually trying, so we can't solve the problem easily either...

I have hundreds of lines of JS code in my .qml files, and outside of them in .js files, and it all works just fine, if that's any help... Take another look at some examples or post some *small* bits of your own code (not entire files please) and we'll likely have a solution for you.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
New Developer
hemant19cse
Posts: 101
Registered: ‎11-08-2012
My Device: 9790
My Carrier: Reliance

Re: cascades support javascript in the qml file

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: cascades support javascript in the qml file

I believe, but can't find where it might be documented, that the name you provide after the "as" *must* be capitalized, as in import "fun.js" as Jscode. (Or JsCode, or whatever.. but not jsCode or jscode.)

(I'd try running something like your code, but I don't feel like retyping it right now. Screenshots always make it harder... we can't quote from them or copy/paste to try it out ourselves.)

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
New Developer
hemant19cse
Posts: 101
Registered: ‎11-08-2012
My Device: 9790
My Carrier: Reliance

Re: cascades support javascript in the qml file

Thanks , It Worked , But i did not understatd the strictness with naming convention . Convension should be followed but not mandatorily followed , Anyway thank you very much . 

Please use plain text.
Developer
oniongarlic
Posts: 72
Registered: ‎10-19-2012
My Device: Playbook, BB10DevAlphaB
My Carrier: Sonera, Saunalahti

Re: cascades support javascript in the qml file

You are importing your javascript file as new type into QML and you might have noticed, they are always capitalized in QML, for example: "Item", "Rectangle", etc
I'm unable to find the documentation for it, but that is how it is.
Please use plain text.
New Developer
hemant19cse
Posts: 101
Registered: ‎11-08-2012
My Device: 9790
My Carrier: Reliance

Re: cascades support javascript in the qml file

Thanks for your support .

Please use plain text.