框架是Struts2,點擊add,添加一行,然後我在後台定義了全局變量code,但是表單提交過去後,沒有接到任何的值.
誰知道這是咋回事?
下面是原型demo,哪位大神幫我改下,改成能提交到後台的,因為我懷疑是我寫的問題
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Row Editing in DataGrid - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<table id="dg" class="easyui-datagrid">
<thead>
<tr>
<th data-options="field:'code'">編碼</th>
<th data-options="field:'name'">名稱</th>
<th data-options="field:'price'">價格</th>
</tr>
</thead>
<tbody>
<tr>
<td>001</td><td>name1</td><td>2323</td>
</tr>
<tr>
<td>002</td><td>name2</td><td>4612</td>
</tr>
</tbody>
</table>
<a class="easyui-linkbutton" onclick="add()">add</a>
<script type="text/javascript">
function add(){
$('#dg').datagrid('appendRow',{
code:'003',
name:'name3',
price:'300'
});
}
</script>
</body>
</html>
關於easyui的使用,可參考 : http://git.oschina.net/wangkang/llsfw
希望能夠幫到你.