我有一行代码看起来像这样回调永远不会被执行:
GroupRepository.Add("#divSortingArea", oGroup, oSow.AddGroupToPage, (function() { alert(123); }));
小伙子们,没有警报弹出窗口!
干杯, Shotemba
这是完整的代码:
function GroupRepository(){ }
GroupRepository.Add = function(targetSelection,oGroup,addToPage){
var tableToInsert = null;
var nGroupID = oGroup.nScopeOfWorkGroupID;
var sDescription = oGroup.sScopeOfWorkGroupDescription;
Eclipse3.GroupService.InsertGroup(Globals.N_JOB_ID, oGroup, InsertGroup_Success, InsertGroup_Error);
function InsertGroup_Success(response) {
nGroupID = parseInt(response.nIdentity);
var bConcurrencyId = response.bNewConcurrencyId;
//If this entry contains rows pull those rows out,
var rows = tableToInsert.find("tbody tr");
tableToInsert.remove();
oGroup.nScopeOfWorkGroupID = nGroupID;
oGroup.bConcurrencyId = bConcurrencyId;
var newGroupElement = addToPage(oGroup);
//add to the new group being created,
newGroupElement.find("tbody").append(rows);
//Globals.DisplayMessage("Insert Succeeded", "Your attempt to add a new record was successful.");
Globals.DisplayMessage("Insert Group Succeeded", "A new record was added.");
return this;
};
function InsertGroup_Error(error) {
Globals.HandleError("Item Group Failed", error);
};
}
答案 0 :(得分:0)
在GroupRepository.Add中,只有3个参数,targetSelection,oGroup和addToPage。要扩展回调,请声明一个新函数:
function newCallBack(param) {
var result = oSow.AddGroupToPage(param);
alert(123);
return(result);
}
然后:
GroupRepository.Add("#divSortingArea", oGroup, newCallBack);