我在我的网站上使用jQuery EasyUI Datagird(http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=)。当我双击每个记录时,应该在IE,Chrome,Safari中打开一个弹出窗口,除了firefox?
点击事件功能被触发,数据填充位置有问题。
function loadMailDetails(rowIndex){
var t = $('#test');
t.datagrid('clearSelections');
t.datagrid('selectRow',rowIndex);
var row = $('#test').datagrid('getSelected');
if (row){
var folderId=$('#sourceFolderid').val();
var isArchive=$('#archiving').val();
var loading=fromLoad;
if(isArchive=="no")
{
jQuery.ajax({
type:'POST',
data:'id=' +row.id+'&folderid='+folderId+"&loading="+loading+"&ummId="+row.ummId,
url:'/'+productName+'/inbox/getEmailDetail',
success:function(data,textStatus){
mailDetails(data,row);
},
async:false ,
cache: false
});
}
else
{
jQuery.ajax({
type:'POST',
data:'id=' +row.id+'&folderid='+folderId+'&ummId='+row.ummId,
url:'/'+productName+'/inbox/getArchiveEmailMessage',
success:function(data,textStatus){
mailDetails(data,row);
},
async:false ,
cache: false
});
}
}
}
if(fromAutoMatch==false)
{
jQuery.ajax({
type:'POST',
url:'/'+productName+'/inbox/openMailPopupDialog',
success:function(data,textStatus){
$('body').append(data);
},
async: false
});
var folderId=$('#sourceFolderid').val();
var isArchive=$('#archiving').val();
var selectedNode = $('#jqueryTree').tree('getSelected')
var selectedText = selectedNode.text;
var tempDrafts = false;
if(selectedText.indexOf("Drafts") >=0){
tempDrafts = true;
}
var loading=fromLoad;
if (rowData){
if(isArchive=="no"){
jQuery.ajax({
type:'POST',
data:'id=' +rowData.id+'&folderid='+folderId+"&isdraft="+tempDrafts+"&loading="+loading,
url:'/'+productName+'/inbox/getEmailDetail',
success:function(data,textStatus){
mailPopup(data);
}
});
}else{
jQuery.ajax({
type:'POST',
data:'id=' +rowData.id+'&folderid='+folderId,
url:'/'+productName+'/inbox/getArchiveEmailMessage',
success:function(data,textStatus){
mailPopup(data);
}
});
}
}
}
},
onRowContextMenu:function(e,rowIndex,rowData){
e.preventDefault();
$('#test').datagrid('selectRow',rowIndex);
var noOfRows = $('#test').datagrid('getSelections').length;
var selectedNode = $('#jqueryTree').tree('getSelected')
var selectedText = selectedNode.text;
var tempNode = $('#jqueryTree').tree('getParent',selectedNode.target);
var parentText = tempNode.text;
if(selectedText.indexOf("Drafts") >= 0 || selectedText.indexOf("Outbox") >= 0 || selectedText.indexOf("Sent Items") >= 0 || selectedText.indexOf("Deleted Items") >= 0 || selectedText.indexOf("Failed Items") >= 0
|| parentText.indexOf("Drafts") >= 0 || parentText.indexOf("Outbox") >= 0 || parentText.indexOf("Sent Items") >= 0 || parentText.indexOf("Deleted Items") >= 0 || parentText.indexOf("Failed Items") >= 0){
$('#archiveEmailRightClickID').css('display','none');
}
if(noOfRows==1)
{
if(rowData.Read==true)
{
$('#markAsRead').css('display','none');
$('#markAsReadId').css('display','none');
$('#markAsUnread').css('display','block');
$('#markAsUnreadId').css('display','block');
}
else
{
$('#markAsRead').css('display','block');
$('#markAsReadId').css('display','block');
$('#markAsUnread').css('display','none');
$('#markAsUnreadId').css('display','none');
}
}
else
{
$('#markAsRead').css('display','block');
$('#markAsUnread').css('display','block');
$('#markAsReadId').css('display','block');
$('#markAsUnreadId').css('display','block');
}
var selectedAccordion = $('#accordionPanel').accordion('getSelected');
var selectedIndex
if (selectedAccordion){
selectedIndex = $('#accordionPanel').accordion('getPanelIndex', selectedAccordion);
}
if(selectedIndex == 1){
$('#gridContextMenu').menu().menu('show',{
left: e.pageX,
top: e.pageY
});
}else if(selectedIndex == 2){
$('#gridContextArchiveMenu').menu().menu('show',{
left: e.pageX,
top: e.pageY
});
}
},
// ,
rowStyler:function(index,row){
if ((row.Read == false || row.Read == "false" || row.Read == "[false]")
&& (row.emailSource == "2" || row.emailSource == 2 || row.emailSource == "[2]")){
return 'font-weight:bold;background-color:#a7cdf0;';
}else if ((row.Read == false || row.Read == "false" || row.Read == "[false]")
&& (row.emailSource != "2" || row.emailSource != 2 || row.emailSource != "[2]")){
return 'font-weight:bold;';
}else if ((row.Read == true || row.Read == "true" || row.Read == "[true]")
&& (row.emailSource == "2" || row.emailSource == 2 || row.emailSource == "[2]")){
return 'background-color:#a7cdf0;';
}
},
onClickRow:function(rowIndex,rowData){
additionaldata = rowData;
loadMailDetails(rowIndex)
},
onDblClickCell :function(rowIndex, field, value){
if(field=="autoMatch")
fromAutoMatch=true;
else
fromAutoMatch=false;
},
onBeforeLoad:function(){
var rows = $('#test').datagrid('getSelections');
if(rows){
$('#test').datagrid('clearSelections');
$('#test').datagrid('clearChecked');
}
}
});
}
答案 0 :(得分:0)
尝试使用onClickRow
将setTimeout( [your code], 0);
中的代码包围起来。