你好在jqgrid我创建了一行,它手动接受输入,所以点击它没有聚焦的文本框,没有光标闪烁,无法输入其中的值。只有当我使用选项卡并导航到该文本框时,才会进行输入。请帮帮我,这是我的代码:
$("#variablesGrid").jqGrid({
datatype: 'local',
data: variableForGrid,
colNames: ['Data Type', 'Is Array', 'Field Name', 'Action'],
colModel: [
{name: 'dataType', index: 'dataType', width: 50, editable: true, edittype: "select", editoptions: {value: dataTypeChoices}, align: "left"},
{name: 'isArray', index: 'isArray', width: 17, editable: true, formatter: "checkbox", edittype: "checkbox", editoptions: {value: "true:false"}, align: "center"},
{name: 'fieldName', index: 'fieldName', width: 40, editable: true, align: "left", editrules: {custom: true, custom_func: check}},
{name: 'act', index: 'act', width: 10, sortable: false}
],
rowNum: 100000,
//rowList: [5, 10, 20],
pager: '#variablesPager',
gridview: true,
rownumbers: true,
sortname: 'invdate',
viewrecords: true,
sortorder: 'desc',
caption: 'Variables',
editurl: 'clientArray',
width: 900,
height: 250,
loadonce: true,
autoencode: true,
loadComplete: function () {
var table = this;
setTimeout(function () {
updatePagerIcons(table);
enableTooltips(table);
}, 0);
},
gridComplete: function () {
var ids = jQuery(grid_selector).jqGrid('getDataIDs');
for (var i = 0; i < ids.length; i++) {
var cl = ids[i];
ce = "<div title=\"\" style=\"float:left;margin-left:5px;\" class=\"ui-pg-div ui-inline-del\" id=\"jDeleteButton_12\" onclick=\"deleteGridRow('" + cl + "','" + hasError + "');\" onmouseover=\"jQuery(this).addClass('ui-state-hover');\" onmouseout=\"jQuery(this).removeClass('ui-state-hover');\" data-original-title=\"Delete selected row\"><span class=\"ui-icon ui-fa fa-trash\"></span></div>";
jQuery(grid_selector).jqGrid('setRowData', ids[i], {act: ce});
}
},
onSelectRow: function (rowid) {
if (isNewRow === false) {
if (rowid !== lastSel) {
var fieldNameValue = jQuery(grid_selector).jqGrid('getCell', lastSel, 'fieldName');
if (fieldNameValue != false) {
if (fieldNameValue.indexOf("name=\"fieldName\"") > 0) {
fieldNameValue = $("#" + lastSel + "_fieldName").val();
if (fieldNameValue == "" || fieldNameValue == " " || MDBPMUtils.hasSpaces(fieldNameValue)) {
hasError = true;
grid.jqGrid('saveRow', lastSel);
$("#" + lastSel + "_fieldName").focus();
jQuery('#variablesGrid').jqGrid('setSelection', lastSel);
}
}
}
}
}
if (hasError === false) {
if (rowid !== lastSel) {
if (lastSel) {
grid.jqGrid('saveRow', lastSel);
}
lastSel = rowid;
}
grid.jqGrid('editRow', rowid, true);
return true;
}
}
});