Pyramid + Dojo

101 views
Skip to first unread message

Fabian Jiménez

unread,
May 9, 2012, 10:19:36 PM5/9/12
to pylons-discuss
Hello to all, I'm novice in pyramid and chameleon. I need to integrate
zpt templates with Dojo. Next a test code, Javacript console gives the
error: "Uncaught TypeError: Object #<an Object> has no method
'byId'".

Thanks in advance. (Sorry, my english)



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://
xml.zope.org/namespaces/tal">
<head>
<meta http-equiv="content-type" content="text/javascript;
charset=utf-8" />
<title>Test</title>
<script type="text/javascript" src="$
{request.static_url('mysamples:static/js/dojo/dojo.js')}"
data-dojo-config="async: true"></script>
</head>
<body>

<h1 class="title">Welcome</h1>
<p>Name: <b tal:replace="banco.ban_name">Name</b></p>
<p>Value: <b tal:replace="banco.ban_sricod">Value</b></p>
<p>Id: <b tal:replace="banco.ban_code">Id</b></p>


<h1 id="greeting">Hello world</h1>
<script type="text/javascript">
require(["dojo/fx", "dojo/dom", "dojo/domReady!"], function(dom,
fx) {
var greeting = dom.byId("greeting");
greeting.innerHTML += " from Dojo!";

fx.slideTo({
top: 200,
left: 300,
node: greeting
}).play();
});
</script>
</body>
</html>

Malthe Borch

unread,
May 10, 2012, 3:37:33 AM5/10/12
to pylons-...@googlegroups.com
It seems like the Dojo-library didn't load correctly, because `dom`
isn't defined. This is a Javascript-issue though.

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

binadam

unread,
May 10, 2012, 2:31:29 PM5/10/12
to pylons-...@googlegroups.com
Shouldn't this part:
    require(["dojo/fx", "dojo/dom", "dojo/domReady!"], function(dom, fx) {  

be:
    require(["dojo/fx", "dojo/dom", "dojo/domReady!"], function(fx, dom) {  

i.e. you have to match the order of the function params with the requires?

Fabian Jiménez

unread,
May 10, 2012, 5:09:15 PM5/10/12
to pylons-discuss
Really no, I test it configuring apache (without zpt code) and
works !.
> > </html>- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

fabian

unread,
May 10, 2012, 3:48:13 PM5/10/12
to pylons-...@googlegroups.com
Really no, I test it configuring apache (without zpt code) and works.


--
View this message in context: http://pylons-discuss.1595796.n2.nabble.com/Pyramid-Dojo-tp7545510p7548072.html
Sent from the pylons-discuss mailing list archive at Nabble.com.
Reply all
Reply to author
Forward
0 new messages