【发布时间】:2018-09-14 06:24:21
【问题描述】:
我是 jeasyui 的新手。我使用 easyui-datagrid 生成了动态表,并且必须为每一行启用复选框。现在我想在选中并取消选中特定行的复选框时获取每一行的详细信息。
<table id="process-list" title="Video Processing" class="easyui-datagrid" style="width:700px;height:250px"
url="$/emplyoee/getfiles.action"
idField="itemid">
<thead>
<tr>
<th field='ck' checkbox="true" type="checkbox" ></th>
<th field="id" width="50" >Id</th>
<th field="createDate" width="50" >CreateDate</th>
<th field="product" width="50">Product</th>
<th field="no.Files" width="50">No.Files</th>
<th field="status" width="50">Status</th>
<th field="cycle" width="50">Cycle</th>
</tr>
</thead>
</table>
$(document).ready(function() {
$('input[name="ck"]').click(function(){
if($(this).prop("checked") == true){
alert("Checkbox is checked.");
}
else if($(this).prop("checked") == false){
alert("Checkbox is unchecked.");
}
});
我尝试了点击功能,但它不起作用。 });
【问题讨论】:
-
欢迎来到 Stackoverflow。你试过什么了?请注意,Stackoverflow 不是编码服务。我们希望您完成研究并至少提出一些尝试,在这些尝试中您被困在某个地方并有一个特定的问题。请阅读:stackoverflow.com/help/how-to-ask 和 stackoverflow.com/help/mcve
-
@Martin:检查我更新的问题。
-
我没有看到任何输入,或者实际上根本没有任何元素,名称属性 name="ck" 附加到您的任何元素。
-
正如@Martin 所提到的,复选框的输入字段在哪里?现在您正在使用
作为您的 的替代品。 .prop("checked") 在这种情况下没有做任何事情,因为您没有检查 @radu apostolescu: 生成动态表,输入标签内会生成 tbody,tr,td。
标签: jquery-easyui