【发布时间】:2016-10-08 23:13:14
【问题描述】:
为什么 onClick 会被自动调用,而不是当我单击单元格时?我希望能够单击单元格,然后加载页面。代码:
colNames:['Name','Status', 'Created On', 'Update By', 'Updated On', 'RetentionDays','ValidityTime','Edit'],
colModel:[
{
name: 'name', width:100,editable: true, edittype:'select',
formatter: "dynamicLink",
"formatoptions":{"onClick":$( "#contents" ).load("jsp/consumers.jsp")},
xmlmap: function (obj) {
return $(obj).attr('name');
}
},
编辑:
$(文档).ready(函数() {
calEventTypes(eventTypesUrl);
$("#eventsDiv").click(function(){
$('#eventsErrorDiv').css("visibility", "hidden");
$('#eventsErrorDiv').css("display", "none");
});
$("#jqGrid").jqGrid({
hidegrid: false,
datatype: 'xmlstring',
datastr : xmlData,
colNames:['Name','Status', 'Created On', 'Update By', 'Updated On', 'RetentionDays','ValidityTime','Edit'],
colModel:[
{
name: 'name', width:100,editable: true, edittype:'select',
formatter: "showlink", idName: null,
onClick: function (options) {
alert("It's clicked!\nI'm going to Google...");
window.location = "https://www.google.com/";
},
xmlmap: function (obj) {
return $(obj).attr('name');
}
},
【问题讨论】:
标签: javascript jquery hyperlink jqgrid onclick