In this function I am loading data from the i into various form panels, this is done in the poOrderHeaderStore.load() callback function (blue font). Loading the data to the form panel takes place at the getForm().loadRecord() method (red font).
Here is the form panel I am working with.
I have added 2 FieldSets to this form (requires array), the following is the code for the FieldSets.
In the first FieldSet I have a CheckBoxGroup (red font), when I do a getValues() on the form, SCHEDDAY is an array (SCHEDDAY: Array[5] 0: "mon" 1: "tue" 2: "wed" 3: "thu" 4: "fri" length: 5). How do I define the CheckBoxGroup array in my RPG program? I'm thinking I will have to build the JSON array and embed it with the vvOut_toJSON. Thank you for your assistance in advance.
Code:
onItemDblClickUpdateVendorTabForm: function(selection, record, item, index, e, eOpts) { /** * declare variables */ var me = this, poPanel = Ext.ComponentQuery.query('pomaintpanel')[0], poMaintDetailGrid = Ext.ComponentQuery.query('pomaintdetailgrid')[0], supplierNumber = record.get('D1VEVEND'), plantNumber = record.get('D1VASTYP'), poOrderHeaderStore = me.getStore('POOrderHeaders'), poOrderDetailStore = me.getStore('POOrderDetails'), poNumber = '', poUniqueIDNumber = '', supplierName = '', titleData = '', gridRec = '', recordCount = 0, daysDiff = 0; /** * set up parameters for the next back end call */ poOrderHeaderStore.getProxy().extraParams = { pgm: 'PUR0060NP1', action: 'newPO', supplierNumber: supplierNumber, plantNumber: plantNumber }; /** * load the new PO data into the po order header store */ poOrderHeaderStore.load({ scope: me, callback: function(records, operation, success) { /** * test if records were passed back from the IBM i */ if (!Ext.isEmpty(records)) { /** * calculate the days difference between the order date and the expected receipt date * the dates are coming from the back end as USA strings 01/01/2001 * fnParseDate converts them into a javascript date type * fnDayDiff returns the number of days between the two dates */ daysDiff = me.fnDaysDiff(me.fnParseDate(records[0].get('ORDERDATE')), this.fnParseDate(records[0].get('EXPRCTDATE'))); /** * store the days difference in a runtime config for later use */ WorkWithPOs.config.Runtime.setDaysDiff(daysDiff); /** * get the PO unique id number from the first record passed in */ poUniqueIDNumber = records[0].get('UNIQUEID'); /** * store the PO unique id number in a runtime config for later use */ WorkWithPOs.config.Runtime.setPOUniqueIDNumber(poUniqueIDNumber); /** * get the PO number from the first record passed in */ poNumber = records[0].get('PONUMBER'); /** * store the PO number in a runtime config for later use */ WorkWithPOs.config.Runtime.setPONumber(poNumber); /** * get the vendor/supplier number from the first record passed in */ supplierNumber = records[0].get('SUPLRNBR'); /** * store the vendor/supplier number in a runtime config for later use */ WorkWithPOs.config.Runtime.setSupplierNumber(supplierNumber); /** * get the vendor/supplier name from the first record passed in */ supplierName = records[0].get('SUPLRNAME'); titleData = records[0].get('TITLEDATA'); /** * set the panel title */ poPanel.setTitle('Purchase Order ' + poNumber + ' for ' + titleData); /** * set the 2nd tab panel as the default */ poPanel.down('pomaintheadertabpanel').setActiveTab(1); /** * load the fields in the form from the first record passed in */ poPanel.down('pomaintvendorform').getForm().loadRecord(records[0]); poPanel.down('pomaintorderform').getForm().loadRecord(records[0]); poPanel.down('pomaintinstructionsform').getForm().loadRecord(records[0]); poPanel.down('pomaintshippingandbillingform').getForm().loadRecord(records[0]); /** * reset the display fields in the summary form */ // poPanel.down('pomaintdetailsummaryform').getForm().reset(); /** * set up the parameters for the next back end call */ poOrderDetailStore.getProxy().extraParams = { pgm: 'PUR0060NP2', action: 'newPO', pouniqueidnumber: poUniqueIDNumber }; /** * load the PO detail store */ poOrderDetailStore.load({ scope: me, callback: function(records, operation, success) { /** * test if records were passed back from the IBM i */ if (!Ext.isEmpty(records)) { // this.calculateSummaryFromStore(); /** * get the record of the first grid row */ gridRec = poMaintDetailGrid.store.getAt(0); /** * get the store record count to control the next and previous item buttons */ recordCount = poMaintDetailGrid.store.count(); /** * store the record count in the runtime config for later use */ WorkWithPOs.config.Runtime.setRecordCount(recordCount); /** * highlight/select the first item grid row */ poMaintDetailGrid.getSelectionModel().select(0); /** * call function to populate the item detail form */ me.poMaintDisplayFirstGridRowInForm(gridRec); } } }); /** * set the mode in the runtime config for later use */ WorkWithPOs.config.Runtime.setMode('newPO'); me.addListenersOrderDateAndReceivingWhs(); /** * hide or show tool bar */ Ext.ComponentQuery.query('cardcontroltoolbar1')[0].hide(); Ext.ComponentQuery.query('cardcontroltoolbar2')[0].show(); Ext.ComponentQuery.query('cardcontrol')[0].getLayout().setActiveItem('POMaintPanel'); } else {} } }); /** * hide the vendor selection window */ me.getVendorInquiryAndSelectionWindow().hide(); },
Code:
Ext.define('WorkWithPOs.view.pomaint.POMaintOrderForm', { extend: 'Ext.form.Panel', alias: 'widget.pomaintorderform', requires: ['WorkWithPOs.view.pomaint.POMaintOrderFormBlanketPOFieldSet', 'WorkWithPOs.view.pomaint.POMaintOrderFormBlanketPOFieldSet1'], // bodyPadding: 10, header: false, border: false, // overflowY: 'auto', // autoScroll: true, initComponent: function() { var me = this; Ext.applyIf(me, { defaults: { width: 750, margin: '5 0 0 5', labelWidth: 150, hideEmptyLabel: false }, items: [{ xtype: 'textfield', fieldLabel: 'Requester', name: 'RQSTDBY', width: 425 }, { xtype: 'datefield', fieldLabel: 'Date Ordered', name: 'ORDERDATE', itemId: 'orderDate', width: 275 }, { xtype: 'datefield', fieldLabel: 'Shipment To Arrive', name: 'EXPRCTDATE', width: 275 }, { xtype: 'combobox', fieldLabel: 'Receiving Whs', editable: false, store: 'RcvngWhs', valueField: 'VVVALUE', value: '20-0', displayField: 'VVREC', name: 'RCVNGWHS', itemId: 'rcvngWhs', width: 425 }, { xtype: 'combobox', fieldLabel: 'F.O.B.', editable: false, // store: 'FOB', queryMode: 'local', store: new Ext.data.ArrayStore({ fields: ['VVVALUE', 'VVREC'], data: [ ['DELIV', 'Delivered'], ['PCKUP', 'Pick Up'] ] // data is local }), valueField: 'VVVALUE', value: 'DELIV', displayField: 'VVREC', name: 'FOB', itemId: 'fob', width: 275 }, { xtype: 'combobox', fieldLabel: 'Routing', editable: false, // store: 'ShipVia', queryMode: 'local', store: new Ext.data.ArrayStore({ fields: ['VVVALUE', 'VVREC'], data: [ ['TRUCK', 'Truck'], ['UPS', 'United Parcel Service'], ['FEDEX', 'Federal Express'] ] // data is local }), valueField: 'VVVALUE', value: 'TRUCK', displayField: 'VVREC', name: 'SHIPVIA', width: 275 }, { xtype: 'combobox', fieldLabel: 'Terms', editable: false, // store: 'Terms', queryMode: 'local', store: new Ext.data.ArrayStore({ fields: ['VVVALUE', 'VVREC'], data: [ ['N/A', 'Not Applicable'], ['NET15', 'Net 15 Days'], ['NET20', 'Net 20 Days'], ['NET30', 'Net 30 Days'], ['3%10D', '3% 10 Days'] ] // data is local }), valueField: 'VVVALUE', value: 'N/A', displayField: 'VVREC', name: 'TERMS', width: 275 }, { xtype: 'combobox', fieldLabel: 'Account Number', editable: false, // store: 'GLAcct', queryMode: 'local', store: new Ext.data.ArrayStore({ fields: ['VVVALUE', 'VVREC'], data: [ ['ACCT1', '20-1060-00'], ['ACCT2', '20-6000-43'] ] // data is local }), valueField: 'VVVALUE', value: 'ACCT1', displayField: 'VVREC', name: 'GLACCTCODE', width: 275 }, { xtype: 'checkboxfield', fieldLabel: 'Blanket PO ?', name: 'BLANKETPO', itemId: 'blanketPO' }, { xtype: 'pomaintorderformblanketpofieldset', hidden: true }, { xtype: 'pomaintorderformblanketpofieldset1', hidden: true }] }); me.callParent(arguments); } });
Code:
Ext.define('WorkWithPOs.view.pomaint.POMaintOrderFormBlanketPOFieldSet', {
extend: 'Ext.form.FieldSet',
alias: 'widget.pomaintorderformblanketpofieldset',
title: 'Scheduled Release',
height: 250,
layout: 'anchor',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
defaults: {
anchor: '100%'
},
items: [{
xtype: 'numberfield',
fieldLabel: '% Release Amount',
labelWidth: 115,
name: 'RLSAMOUNT',
itemId: 'rlsAmount',
anchor: '25%',
minValue: 0,
maxValue: 100,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
maxLength: 5,
enforceMaxLength: true
}, {
xtype: 'radiogroup',
itemId: 'frequency',
fieldLabel: 'Frequency',
labelWidth: 115,
layout: {
autoFlex: false
},
defaults: {
name: 'FREQUENCY',
margin: '0 15 0 0'
},
items: [{
inputValue: 'weekly',
boxLabel: 'Weekly',
itemId: 'frequencyWeekly'
// checked: true
}, {
inputValue: 'biweekly',
itemId: 'frequencyBiweekly',
boxLabel: 'Biweekly'
}, {
inputValue: 'monthly',
itemId: 'frequencyMonthly',
boxLabel: 'Monthly'
}]
}, {
xtype: 'checkboxgroup',
width: 300,
itemId: 'scheduleDay',
fieldLabel: 'Schedule Day',
labelWidth: 115,
columns: 9,
defaults: {
name: 'SCHEDDAY',
margin: '0 15 0 0'
},
items: [{
boxLabel: 'Mon',
inputValue: 'mon'
}, {
boxLabel: 'Tue',
inputValue: 'tue'
}, {
boxLabel: 'Wed',
inputValue: 'wed'
}, {
boxLabel: 'Thu',
inputValue: 'thu'
}, {
boxLabel: 'Fri',
inputValue: 'fri'
}]
}, {
xtype: 'container',
layout: {
type: 'table',
columns: 2
},
items: [{
xtype: 'combobox',
labelWidth: 115,
fieldLabel: 'Schedule Date',
queryMode: 'local',
store: new Ext.data.ArrayStore({
fields: ['VVVALUE', 'VVREC'],
data: [
['1', 'Week 1'],
['2', 'Week 2'],
['3', 'Week 3'],
['4', 'Week 4']
] // data is local
}),
valueField: 'VVVALUE',
// value: '1',
displayField: 'VVREC',
name: 'SCHEDWEEK',
itemId: 'scheduleWeek',
editable: false,
margin: '0 15 5 0',
width: 220
// anchor: '25%'
}, {
xtype: 'radiogroup',
width: 300,
itemId: 'scheduleMonthDay',
defaults: {
name: 'SCHEDMTHDY',
margin: '0 15 0 0'
},
items: [{
inputValue: 'mon',
boxLabel: 'Mon'
}, {
inputValue: 'tue',
boxLabel: 'Tue'
}, {
inputValue: 'wed',
boxLabel: 'Wed'
}, {
inputValue: 'thu',
boxLabel: 'Thu'
}, {
inputValue: 'fri',
boxLabel: 'Fri'
}]
}]
}, {
xtype: 'container',
layout: {
type: 'table',
columns: 3
},
items: [{
xtype: 'datefield',
fieldLabel: 'Omit Dates',
labelWidth: 115,
name: 'OMITDATE00',
width: 220,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}, {
xtype: 'datefield',
// hideEmptyLabel: false,
name: 'OMITDATE01',
width: 100,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}, {
xtype: 'datefield',
// hideEmptyLabel: false,
name: 'OMITDATE02',
width: 100,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}]
}, {
xtype: 'container',
layout: {
type: 'table',
columns: 3
},
items: [{
xtype: 'datefield',
// fieldLabel: 'Omit Dates',
name: 'OMITDATE03',
width: 220,
labelWidth: 115,
hideEmptyLabel: false,
margin: '0 15 5 0',
// anchor: '32%'
disabledDays: [0,6],
minValue: new Date()
}, {
xtype: 'datefield',
// hideEmptyLabel: false,
name: 'OMITDATE04',
width: 100,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}, {
xtype: 'datefield',
// hideEmptyLabel: false,
name: 'OMITDATE05',
width: 100,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}]
}, {
xtype: 'container',
layout: {
type: 'table',
columns: 3
},
items: [{
xtype: 'datefield',
// fieldLabel: 'Omit Dates',
name: 'OMITDATE06',
width: 220,
hideEmptyLabel: false,
labelWidth: 115,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}, {
xtype: 'datefield',
// hideEmptyLabel: false,
name: 'OMITDATE07',
width: 100,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}, {
xtype: 'datefield',
// hideEmptyLabel: false,
name: 'OMITDATE08',
width: 100,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}]
}, {
xtype: 'container',
layout: {
type: 'table',
columns: 3
},
items: [{
xtype: 'datefield',
// fieldLabel: 'Omit Dates',
name: 'OMITDATE09',
width: 220,
labelWidth: 115,
hideEmptyLabel: false,
margin: '0 15 0 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}, {
xtype: 'datefield',
// hideEmptyLabel: false,
name: 'OMITDATE10',
width: 100,
margin: '0 15 0 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}, {
xtype: 'datefield',
// hideEmptyLabel: false,
name: 'OMITDATE11',
width: 100,
margin: '0 15 0 0',
disabledDays: [0,6],
minValue: new Date()
// anchor: '32%'
}]
}]
});
me.callParent(arguments);
}
});
Ext.define('WorkWithPOs.view.pomaint.POMaintOrderFormBlanketPOFieldSet1', {
extend: 'Ext.form.FieldSet',
alias: 'widget.pomaintorderformblanketpofieldset1',
// xtype: 'fieldset',
title: 'Dates Release',
width: 725,
height: 200,
layout: 'anchor',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
defaults: {
anchor: '100%'
},
items: [{
xtype: 'numberfield',
fieldLabel: '% Release Amount',
labelWidth: 115,
name: 'RLSAMOUNT1',
itemId: 'rlsAmount1',
anchor: '25%',
minValue: 0,
maxValue: 100,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false,
maxLength: 5,
enforceMaxLength: true
}, {
xtype: 'container',
layout: {
type: 'table',
columns: 3
},
items: [{
xtype: 'datefield',
fieldLabel: 'Schedule Dates',
name: 'SCHEDDAT00',
labelWidth: 115,
width: 220,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
}, {
xtype: 'datefield',
name: 'SCHEDDAT01',
width: 100,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
}, {
xtype: 'datefield',
name: 'SCHEDDAT02',
width: 100,
margin: '0 15 5 0',
disabledDays: [0,6],
minValue: new Date()
}]
}, {
xtype: 'container',
layout: {
type: 'table',
columns: 3
},
items: [{
xtype: 'datefield',
// fieldLabel: 'Schedule Dates',
hideEmptyLabel: false,
name: 'SCHEDDAT03',
labelWidth: 115,
width: 220,
margin: '0 15 5 0'
}, {
xtype: 'datefield',
name: 'SCHEDDAT04',
width: 100,
margin: '0 15 5 0'
}, {
xtype: 'datefield',
name: 'SCHEDDAT05',
width: 100,
margin: '0 15 5 0'
}]
}, {
xtype: 'container',
layout: {
type: 'table',
columns: 3
},
items: [{
xtype: 'datefield',
// fieldLabel: 'Schedule Dates',
labelWidth: 115,
hideEmptyLabel: false,
name: 'SCHEDDAT06',
width: 220,
margin: '0 15 5 0'
}, {
xtype: 'datefield',
name: 'SCHEDDAT07',
width: 100,
margin: '0 15 5 0'
}, {
xtype: 'datefield',
name: 'SCHEDDAT08',
width: 100,
margin: '0 15 5 0'
}]
}, {
xtype: 'container',
layout: {
type: 'table',
columns: 3
},
items: [{
xtype: 'datefield',
// fieldLabel: 'Schedule Dates',
labelWidth: 115,
hideEmptyLabel: false,
name: 'SCHEDDAT09',
width: 220,
margin: '0 15 5 0'
}, {
xtype: 'datefield',
name: 'SCHEDDAT10',
width: 100,
margin: '0 15 5 0'
}, {
xtype: 'datefield',
name: 'SCHEDDAT11',
width: 100,
margin: '0 15 5 0'
}]
}]
});
me.callParent(arguments);
}
});
Comment