2
我想在文本框中顯示jqgrid的一列值,它僅在我選擇該單元格時出現在文本框中。 但是我想在數據加載並綁定jqgrid時顯示它。這裏是我的javascript代碼:JQGrid列中的文本框
$("#denominators").jqGrid({
url: '[path to server action for data]',
contentType: "application/json",
datatype: "json",
mtype: "GET",
colNames: ["", "Denomination Name", "Denomination Value", "Quantity Counted", "Extended Amount"],
colModel: [
//{ name: 'id', index: 'id', width: 55 },
{ name: "denominationid", align: "center" },
{ name: "denominationname", },
{ name: "multiplier", formatter: 'integer', formatoptions: { decimalPlaces: 2 }, align: "right" },
{
name: "denominatorcount", formatter: 'integer', editable: true, edittype: 'text', formatoptions: { decimalPlaces: 0 },
editrules: { number: true, required: true, minValue: 0 }, align: "right",
editoptions:
{
dataInit: function (element) {
$(element).keypress(function (e) {
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57))
return false;
});
}
}
},
{
name: 'total', index: 'total', align: 'right',formatoptions: { decimalPlaces: 2 },
formatter: function (cellvalue, options, rowObject) {
var denom = parseFloat(rowObject[2]).toFixed(2),
qty = parseInt(rowObject[3], 10);
return $.fmatter.util.NumberFormat(denom * qty, $.jgrid.formatter.integer);
}
}
],
//height: '120',
//width: null,
shrinkToFit: false,
'cellEdit': true,
'cellsubmit' : 'clientArray',
editurl: 'clientArray',
loadonce: true,
sortname: "DenominationID",
sortorder: "desc",
cmTemplate: { sortable: false },
viewrecords: true,
gridview: true,
autoencode: true,
footerrow: true,
scrollOffset: 0,
});