问题
双击单元格时,获取该行的记录内容
$('#list').datagrid({
method: 'post',
url: 'user/list',
queryParams:{
sex : "f",
age : "18~25"
},
fitColumns: true,
pageList: [ 5, 10, 15, 20 ],
singleSelect: false,
pagination: true,
fit: true,
rownumbers: true,
checkOnSelect: true,
//通过点击单元格获取单元格所在行的所有值
onDbClickCell: function(rowIndex, field, value){
console.log("行:"+rowIndex);
console.log("行标:"+field);
console.log("值:"+value);
}
}
})
解决办法:
onDbClickCell: function(rowIndex, field, value){
var row =$('#list').datagrid('getRows')[rowIndex];//获取行记录
console.log(row.name);
}