我正在尝试在我的网格上进行行选择,但在设置或获取 datakey 值时遇到了困难,因为我在上面找不到任何文档。
$("#divGrid").igGrid({
columns: [
{ headerText: "@Manage.gridColumnEmployeeNumber", key: "EmployeeNumber" },
],
dataKeyFields: "EmployeeNumber", //Is this how you set the dataKeys?
autoGenerateColumns: false,
dataSource: jsonp,
features: [
{
name: "Selection",
rowSelectionChanging: rowSelectionChanging
}
]
});
});
这根本不起作用。如何在这部分代码中访问我的 dataKey (primaryKey)?
function rowSelectionChanging(evt, ui) {
if (confirm) {
var rows = ui.getSelectedRows();
var selectedRow = rows.getItem(0);
var selectedDataKey = selectedRow.get_dataKey();
alert(selectedDataKey);
} else {
return false;
}
}