Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F946998
create_widgets.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
create_widgets.html
View Options
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<
html
>
<
head
>
<
title
>
PROGRAMMATIC - Dojo Widget Creation Test
</
title
>
<
script
type
=
"text/javascript"
src
=
"../../dojo/dojo.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"../dijit.js"
></
script
>
<
script
type
=
"text/javascript"
>
var
queryCount
=
location
.
search
.
match
(
/count=(\d*)/
);
var
count
=
(
queryCount
?
parseInt
(
queryCount
[
1
])
:
100
);
var
queryClass
=
location
.
search
.
match
(
/class=([a-zA-z.]*)/
);
var
className
=
(
queryClass
?
queryClass
[
1
]
:
"form.Button"
);
dojo
.
require
(
"dijit."
+
className
);
dojo
.
require
(
"dojo.parser"
);
logMessage
=
window
.
alert
;
</
script
>
<
style
type
=
"text/css"
>
@
import
"../themes/tundra/tundra.css"
;
/* group multiple buttons in a row */
.
box
{
display
:
block
;
text-align
:
center
;
}
.
box
.
dojoButton
{
width
:
80
px
;
margin-right
:
10
px
;
}
.
dojoButtonContents
{
font-size
:
1.6
em
;
}
#
buttonContainer
{
border
:
1
px
solid
black
;
width
:
100
%
;
}
#
results
{
color
:
darkred
;
}
</
style
>
</
head
>
<
body
class
=
tundra
>
<
script
language
=
'javascript'
>
document
.
write
(
"<h2>Currently Creating "
+
count
+
" "
+
className
+
" instances</h2>"
);
</
script
>
Pass
<
code
>
?count=
<
i
><
b
>
100
</
b
></
i
></
code
>
in the query string to change the number of widgets.
<
br
>
Pass
<
code
>
?class=
<
i
><
b
>
form.Button
</
b
></
i
></
code
>
in the query string to change the widget class.
<
h3
id
=
"results"
></
h3
>
<
div
id
=
"buttonContainer"
class
=
'box'
></
div
>
<
br
>
<
script
type
=
"text/javascript"
>
// See if we can make a widget in script and attach it to the DOM ourselves.
var
constructor
=
dojo
.
getObject
(
"dijit."
+
className
);
function
makeEm
(){
var
container
=
dojo
.
byId
(
"buttonContainer"
);
var
t0
=
new
Date
().
getTime
();
for
(
var
i
=
1
;
i
<=
count
;
i
++
)
{
var
it
=
new
constructor
(
{
label
:
"Button "
+
i
,
onclick
:
'logMessage("clicked simple")'
}
);
container
.
appendChild
(
it
.
domNode
);
it
.
domNode
.
style
.
display
=
''
;
}
var
t1
=
new
Date
().
getTime
();
dojo
.
byId
(
"results"
).
innerHTML
=
"It took "
+
(
t1
-
t0
)
+
" msec to create "
+
count
+
" "
+
className
+
" instances programmatically."
;
}
dojo
.
addOnLoad
(
makeEm
);
</
script
>
</
body
>
</
html
>
File Metadata
Details
Attached
Mime Type
text/html
Expires
Sat, Apr 26, 09:54 (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
22186
Default Alt Text
create_widgets.html (2 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment