<div id="top_country" >
<div id="selected_country" style="border: 1px solid #E2F0F9;width:100%;height:200px;">
<table id="dg" class="easyui-datagrid" style="font-size:10px;height: 200px;"
url="<%=basePath%>region/queryallCountry" rownumbers="true" fitColumns="true">
<thead>
<tr>
<th hidden="true" field="uuid" width="100px">uuid</th>
<th field="ck" checkbox=true></th>
<th field="countryname" width="100px" halign="center">国家列表</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
想把选中的项append到右边
我看你这个是在Datagrid上加入复选按钮 那就调用datagrid 的API $("#dg").datagrid("getSelections")这个会返回所有rows
或者是 1.3版本之后的 $("#dg").datagrid("getChecked") 这个方法也是返回所有选中的行 我一般用第一个
你得需要这个控件定义一个唯一值ID属性,应该就可以了。
你得需要这个控件定义一个唯一值ID属性,应该就可以了
$(":checked[value]") 获取带有value属性的input项
$("#dg").datagrid("getChecked")
var dg =$("#dg").datagrid("getChecked");
<script>
function getCheckedRows(){
var rows=$("#dg").datagrid("getChecked"); //获取到列表选中的行
if(rows!=null && rows.length>0){//判断如果选中行不为空
for(var i=0;i<rows.length;i++){
alert(rows[i].uuid);// 一次循环输出每行的uuid属性值
}
// return rows; //也可以返回选中的行
}
else{
alert("当前无选中的行");
//return null;
}
}
</script>