我想在将值存储到数据库中后刷新动态创建的表。我尝试如下:
$('#caseTbl tr').each(function(){
$(this).droppable({
activeClass: "ui-state-default",
hoverClass: "ui-drop-hover",
accept: "#serviceTechs tr",
over: function(event, ui) {
var $this = $(this);
},
drop: function(event, ui) {
var caseNo=$(this).find('td:eq(0)').text();
var servTechName=$(ui.draggable).find('td:eq(0)').text();
updateDB(caseNo,servTechName);
},
});
});
function updateDB(caseNo,servTechName){
alert("CaseNo>> "+caseNo+ " || servTechName>> "+servTechName);
var caseObj=new sforce.SObject("Case");
var stechQuery=sforce.connection.query("SELECT Id from Service_Technician__c Where Name ='"+servTechName+"' LIMIT 1");
stRecord=stechQuery.getArray('records');
stechId=stRecord[0].Id;
var caseQuery=sforce.connection.query("SELECT Id from Case Where CaseNumber ='"+caseNo+"' LIMIT 1");
caseRecord=caseQuery.getArray('records');
caseObj.Id=caseRecord[0].Id;
caseObj.Assigned_To__c=stechId;
alert("stechObj>> "+caseObj.Assigned_To__c);
sforce.connection.update([caseObj]);
window.location.reload();
}
而不是使用此window.location.reload();
,如何单独刷新表。
您可以通过 Loading Page Fragments
.文档
function RefreshTable() {
$( "#YourTaleID" ).load( "yourpage.html #YourTaleID" );
}