我有一个下拉列表,其中包含“全部,活动和不活动”。当选择不活动时,它们显示表中的所有不活动用户以及与活动用户相同的用户。但是,我希望光标焦点停留在下拉列表上,但焦点始终跳到最后一个单元格列标题。我尝试过
$("#<%= ddlShowStaffStatus.ClientId %>").focus();
,当我注释掉loadStaffGroup()
(列出所有非活动用户和活动用户)时,它会起作用。无论如何,我的光标焦点停留在dropdownlist上,并且同时使用loadstaffgroup()。请参见下面的代码。谢谢。
$("#ddlShowStaffStatus").on("change", function () {
loadStaffGroup();
});
function loadStaffGroup() {
var hdGroupUsersList = '#<%=hdGroupUsersList.ClientID %>';
var tblTemp = '#tblManageGroup';
var objGrp = new objForm();
var initObj = {};
initObj.sda = objGrp.sda;
initObj.programId = objGrp.programId;
initObj.programCode = objGrp.programCode;
initObj.groupId = objGrp.groupId;
initObj.inactiveUser = objGrp.inactiveUser;
initObj.locationValue = objGrp.locationValue;
initObj.locationType = objGrp.locationType;
var url = 'CaseStaffAssign.aspx/GetStaffCaseAssignmentGroup';
$.ajax({
beforeSend: function () {
$('.loader').show();
},
complete: function () {
$('.loader').hide();
},
error: function (msg) {
alert("loadStaffCaseAssignmentGroup - error:" + JSON.stringify(msg));
},
url: url,
type: "POST",
async: true,
data: JSON.stringify(initObj),
processData: false,
contentType: "application/json; charset=utf-8",
success: function (data) {
var results = data.d;
if (results.length > 0) {
showHideDiv(true);
var tblTempBody = $(tblTemp + " tbody");
tblTempBody.empty();
for (var i = 0; i < results.length; i++) {
var oUsername = results[i].StaffLoginname;
var oFirstName = results[i].FirstName;
var oLastName = results[i].LastName;
var oAssign = results[i].col_Assign;
var oGroupLead = results[i].col_GroupLead;
var row = "<tr>" +
"<td>" + oUsername + "</td>" +
"<td>" + oFirstName + "</td>" +
"<td>" + oLastName + "</td>" +
"<td style='text-align: center;'>" + oAssign + "</td>" +
"<td style='text-align: center;'>" + oGroupLead + "</td>" +
"</tr>";
tblTempBody.append(row);
var rows = results.length - 1
if (i == rows) {
var ret = results[i].GroupUsersList;
$(hdGroupUsersList).val(ret);
}
}
//alert('from loadStaffGroup() ' + $(hdGroupUsersList).val());
$(tblTemp).trigger('update');
}
else {
showHideDiv(false);
}
},
});
}
Protected Sub InitialLoad()
With ddlShowStaffStatus
.DataSource = CaseAssignmentManager.GetLookUpItemsWiaCommon("staff", "active_staff", AppUser.Lang, "0")
.DataTextField = "Description"
.DataValueField = "Value"
.DataBind()
.SelectedValue = "2"
End With
GetInfoByGroupID()
GetCaseAssignedGoupInfo()
GetCaseAssignedOtherGroupMembers()
ddlShowStaffStatus.Focus()
End Sub
焦点跳到表格的最后一列标题,但我需要它留在下拉列表中