orderForm
ユーザーが検証する行数を追加できる div内にjqGridがあります。
私がやりたいことは: ユーザーが行を jqGrid に追加するたびに、TOTAL_LINE_AMOUNT
列の合計が一緒に追加され、ラベルに挿入されますSubtotal
$('#orderForm).jqGrid({
data: details,
datatype: 'local',
colNames: ['ID', 'QUANTITY', 'MODEL_ORDER_NUM', 'DESCRIPTION', 'PRICE_EACH', 'TOTAL_LINE_AMOUNT'],
colModel: [
{ name: 'DETAIL_RECORD_ID', index: 'DETAIL_RECORD_ID', sorttype: 'string' },
{ name: 'QUANTITY', index: 'QUANTITY', sorttype: 'string' },
{ name: 'MODEL_ORDER_NUM', index: 'MODEL_ORDER_NUM', sorttype: 'string' },
{ name: 'DESCRIPTION', index: 'DESCRIPTION', sorttype: 'string' },
{ name: 'PRICE_EACH', index: 'PRICE_EACH', sorttype: 'string' },
{ name: 'TOTAL_LINE_AMOUNT', index: 'TOTAL_LINE_AMOUNT', sorttype: 'string' }
],
search: true,
onSelectRow: LoadInput,
loadonce: false,
jsonReader: { cell: '' },
sortname: 'DETAIL_RECORD_ID',
sortorder: 'asc',
sortable: true,
ignoreCase: true,
viewrecords: true,
height: 'auto',
width: 'auto',
shrinkToFit: false,
hiddengrid: false,
caption: 'Detail Records'
});
更新:グリッドにデータをロードする方法は次のとおりです
Form.Controller.orderForm = new function () {
var _detailRecordId = 1;
this.Create = function () {
var requestData = Controller.GetRequestData();
requestData.orderForm.push({
DETAIL_RECORD_ID: "T" + _detailRecordId++,
REQUEST_RECORD_ID: requestData.REQUEST_RECORD_ID,
QUANTITY: $('#orderForm_QUANTITY_INPUT').val(),
MODEL_ORDER_NUM: $('#orderForm_MODEL_ORDER_NUM_INPUT').val(),
DESCRIPTION: $('#orderForm_DESCRIPTION_INPUT').val(),
PRICE_EACH: $('#orderForm_PRICE_EACH_INPUT').val(),
TOTAL_LINE_AMOUNT: $('#orderForm_TOTAL_LINE_AMOUNT_INPUT').text()
});
Form.View.orderFrom.LoadGrid(requestData.orderForm);
};