使用自定义格式化程序将文本框添加到网格中的列后,我无法在网格呈现后以任何方式选择或更改文本。我不想在线编辑,也不想让网格将更改保留回服务器,我只是希望能够更改此列的文本,然后让独立于网格的另一个操作询问行并更新服务器。
谢谢你,斯蒂芬
网格:
var favoriteGrid;
var colNames = ['Qty', 'Attributes', 'Item #', 'Brand', 'Product', 'Catalog', 'Price', 'UOM', 'Case', 'Remarks', 'Wt.', 'Par', 'Date', 'ProductId', '', 'CatalogId'];
var colModel = [
{ name: 'Quantity', index: 'Quantity', width: 22, formatter: quantityFormatter/*, editable:true, edittype:'text'*/ },
{ name: 'ProductAttributes', index: 'ProductAttributes', sortable: false, width: 50, title: false, formatter: productFormatter },
{ name: 'ItemNum', index: 'ItemNum', width: 50, align: "right" },
{ name: 'BrandName', index: 'BrandName', width: 100 },
{ name: 'ProducName', index: 'ProducName', width: 150 },
{ name: 'Catalog', index: 'Catalog', width: 100 },
{ name: 'Price', index: 'Price', width: 40, sorttype: "number", align: "right" },
{ name: 'UOM', index: 'UOM', width: 30 },
{ name: 'CasePack', index: 'CasePack', width: 30 },
{ name: 'PackageRemarks', index: 'PackageRemarks', width: 80 },
{ name: 'AveWeight', index: 'AveWeight', width: 30, title: false, align: "right" },
{ name: 'Par', index: 'Par', width: 25, title: false, align: "right"},
{ name: 'LastPurchaseDate', index: 'LastPurchaseDate', width: 44, align: "right", formatter: 'date', formatoptions: { newformat: 'm/d/Y'} },
{ name: 'ProductId', index: 'ProductId', hidden: true, key: true },
{ name: 'SortPriority', index: 'SortPriority', width: 20, sorttype: "number", align: "right" },
{ name: 'CatalogId', index: 'CatalogId', hidden: true }
];
function quantityFormatter(cellvalue, options, rowObject) {
return '<input type="text" class="qty-order" value="' + cellvalue + '" class="text" title="' + rowObject[13] + '" id="qty-' + rowObject[13] + '"/>';
};
function productFormatter(cellvalue, options, rowObject) <Omitted...>
favoriteGrid = $('#favoriteGrid');
$.jgrid.no_legacy_api = true;
favoriteGrid.jqGrid({
url: '/Buyer/Favorite/ItemsService/' + urlIndex,
datatype: 'json',
mtype: 'GET',
ajaxGridOptions: { contentType: "application/json" },
jsonReader: {
id: "ProductId",
cell: "",
root: function (obj) { return obj.rows; },
page: function () { return 1; },
total: function () { return 1; },
records: function (obj) { return obj.rows.length; },
repeatitems: true
},
/*
cellEdit: true,
cellSubmit: null,
cellurl: null,
*/
colNames: colNames,
colModel: colModel,
pager: $('#favoritePager'),
pginput: true,
rowNum: 1000,
autowidth: true,
height: getProposedHeight(),
sortable: true,
multiselect: true,
viewrecords: true,
ignoreCase: true,
loadonce: true,
loadui: 'block',
emptyrecords: 'Nothing to display',
ondblClickRow: function (rowid, e) {
myClickHandle.call(this, rowid);
},
loadComplete: function () {
var gd = $('#favoriteGrid');
fixGridSize(gd);
/*var ids = favoriteGrid.jqGrid('getDataIDs');*/
}
}).jqGrid('navGrid', '#favoritePager',
{ add: false, edit: false, del: false, search: true, refresh: false },
{},
{},
{},
{ multipleSearch: true, showQuery: false },
{}).jqGrid('sortableRows', {
update: function (ev, ui) {
}
});