Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F946523
test_expand.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
test_expand.html
View Options
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<
html
>
<
head
>
<
title
>
Test dojox.Grid Expand Rows
</
title
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
></
meta
>
<
style
type
=
"text/css"
>
@
import
"../_grid/Grid.css"
;
body
{
font-size
:
0.9
em
;
font-family
:
Geneva
,
Arial
,
Helvetica
,
sans-serif
;
}
.
heading
{
font-weight
:
bold
;
padding-bottom
:
0.25
em
;
}
.
bigHello
{
height
:
110
px
;
line-height
:
110
px
;
text-align
:
center
;
font-weight
:
bold
;
font-size
:
30
px
;
}
#
grid
{
border
:
1
px
solid
#333
;
height
:
30
em
;
}
</
style
>
<
script
type
=
"text/javascript"
src
=
"../../../dojo/dojo.js"
djConfig
=
"isDebug:false, parseOnLoad: true"
></
script
>
<
script
type
=
"text/javascript"
>
dojo
.
require
(
"dojox.grid.Grid"
);
dojo
.
require
(
"dojox.grid._data.model"
);
dojo
.
require
(
"dojo.parser"
);
</
script
>
<
script
type
=
"text/javascript"
>
// grid structure
// a grid view is a group of columns
// a special view providing selection feedback
var
rowBar
=
{
type
:
'dojox.GridRowView'
,
width
:
'20px'
};
// inRow is an array of subRows. we hide the summary subRow except for every nth row
function
onBeforeRow
(
inDataIndex
,
inRow
)
{
inRow
[
1
].
hidden
=
(
!
this
.
grid
||
!
this
.
grid
.
expandedRows
||
!
this
.
grid
.
expandedRows
[
inDataIndex
]);
}
var
view
=
{
onBeforeRow
:
onBeforeRow
,
cells
:
[
[
{
name
:
'Whatever'
,
width
:
4.5
,
get
:
getCheck
,
styles
:
'text-align: center;'
},
{
name
:
'Column 0'
},
{
name
:
'Column 1'
},
{
name
:
'Column 2'
},
{
name
:
'Column 3'
},
{
name
:
'Column 4'
}
],
[
{
name
:
'Detail'
,
colSpan
:
6
,
get
:
getDetail
}
]
]
};
// a grid structure is an array of views.
var
structure
=
[
rowBar
,
view
];
// get can return data for each cell of the grid
function
get
(
inRowIndex
)
{
return
[
this
.
index
,
inRowIndex
].
join
(
', '
);
}
function
getDetail
(
inRowIndex
)
{
if
(
this
.
grid
.
expandedRows
[
inRowIndex
])
{
var
n
=
(
inRowIndex
%
2
);
switch
(
n
)
{
case
0
:
return
'Hello World!'
;
default
:
return
'<div class="bigHello">Hello World!</div>'
;
}
}
else
return
''
;
}
function
toggle
(
inIndex
,
inShow
)
{
grid
.
expandedRows
[
inIndex
]
=
inShow
;
grid
.
updateRow
(
inIndex
);
}
function
getCheck
(
inRowIndex
)
{
if
(
!
this
.
grid
.
expandedRows
)
this
.
grid
.
expandedRows
=
[
];
var
image
=
(
this
.
grid
.
expandedRows
[
inRowIndex
]
?
'open.gif'
:
'closed.gif'
);
var
show
=
(
this
.
grid
.
expandedRows
[
inRowIndex
]
?
'false'
:
'true'
)
return
'<img src="images/'
+
image
+
'" onclick="toggle('
+
inRowIndex
+
', '
+
show
+
')" height="11" width="11">'
;
}
dojo
.
addOnLoad
(
function
()
{
window
[
"grid"
]
=
dijit
.
byId
(
"grid"
);
});
</
script
>
</
head
>
<
body
>
<
div
class
=
"heading"
>
dojox.Grid Expand Row Example
</
div
>
<
div
id
=
"grid"
dojoType
=
"dojox.VirtualGrid"
get
=
"get"
structure
=
"structure"
rowCount
=
"100000"
autoWidth
=
"true"
></
div
>
</
body
>
</
html
>
File Metadata
Details
Attached
Mime Type
text/html
Expires
Sat, Apr 26, 07:21 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27054
Default Alt Text
test_expand.html (2 KB)
Attached To
rZEDHG ZedLegacy
Event Timeline
Log In to Comment