SoFunction
Updated on 2025-04-13

JS small practice code 2


/************************** GridPanel **************************************/
var beginMyPanel = (,{
insertWin:new myWindow(),
constructor:function()
{
// = new myWindow() ;
var myData =
[
["th","91","non-female","Earth"],
["thtwin","92","Male","Earth"],
["thtwinj2ee","93","non-female","Earth"],
["thj2ee","94","Male","Earth"],
["thtwin","95","non-female","Earth"]
] ;
var myRecord =
(
["name","age","sex","addr"]
) ;
var myColumn = new
(
[
{header:"name",dataIndex:"name"},
{header:"Age",dataIndex:"age"},
{header:"Gender",dataIndex:"sex"},
{header:"addr",dataIndex:"addr"}
]
) ;
var myStore = new
(
{
proxy:new (myData),
reader:new
(
{},
myRecord
)
}
) ;

(
this,
{
title:"myGridPanel(thtwinj2ee)",
frame:true,
width:418,
height:250,
cm:myColumn,
ds:myStore,
style:"margin:20,0,10,250",
tbar:
[
{
text:"Add personnel",
handler:function()
{
() ;
},
scope:this
},
"-",//The result is:|
{text:"Modify Personnel"},
"-",
{text:"Delete Personnel"}
],
selModel:new
(
{
listeners:
{
"rowselect":
{
fn:function(row,index,record)
{
("The name of the modified GridPanel!") ;
//Note the following sentence **** 1 *******
("rowselect",record) ;
},
scope:this
}
}
}
),
renderTo:()
}
) ;
() ;
//Note the following sentence **** 2 *******
("rowselect") ;
("submit",,this) ;
},
insert:function(myRecord)
{
().add(myRecord) ;
},
onInsertWinSubmit:function(insertWin,myRecord)
{
(myRecord) ;
}
}) ;
</script>
3. Performance of static html pages
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="../AllRes/resources/css/"/>
<script type="text/javascript" src="../AllRes/adapter/ext/"></script>
<script type="text/javascript" src="../AllRes/"></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script>
(function(){
() ;
="side" ;
(,{
"age":function(value)
{
// Here you need to use regular expressions to make
if(/^\d+$/.test(value))
{
return true ;
}
return false ;
},
"ageText":"Please enter the correct age!"
}
) ;
/* var newnewMyWindowForm = new myWindowForm() ;
(()) ;
*/
// var newnewMyWindow = new myWindow() ;
// () ;
var myGridPanel = new beginMyPanel() ;
var myForm = new beginFormPanel() ;
//Note the relationship between the following sentence and **** 1 **** and **** 2 ****

(
"rowselect",
function(selectedRow)
{
().loadRecord(selectedRow) ;
},
myForm
) ;
}) ;
</script>
</head>
<body>
</body>
</html>