Jquery callback not firing
I've got a line of code that looks like this where the callback never gets executed:
GroupRepository.Add("#divSortingArea", oGroup, oSow.AddGroupToPage, (function() { alert(123); }));
Thks guys, no alert popup !
Cheers, Shotemba
here is the full code:
function GroupRepository() { }
GroupRepository.Add = function(targetSelectio开发者_运维问答n, 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);
};
}
In your GroupRepository.Add there's only 3 parameters, targetSelection, oGroup and addToPage. To extend the callback, declare a new function:
function newCallBack(param) {
var result = oSow.AddGroupToPage(param);
alert(123);
return(result);
}
and then:
GroupRepository.Add("#divSortingArea", oGroup, newCallBack);
精彩评论