Skip to content

Instantly share code, notes, and snippets.

@kevinguto
Last active August 8, 2023 16:39
Show Gist options
  • Save kevinguto/12a3cfe77d191e4330473f7714419b48 to your computer and use it in GitHub Desktop.
Save kevinguto/12a3cfe77d191e4330473f7714419b48 to your computer and use it in GitHub Desktop.
Dump
/* this.editor = new Ext.ux.grid.RowEditor({
saveText: 'Update',
clicksToEdit: 20
});*/
/*this.editor.on('beforeedit', this.onEditOperation, this);
this.editor.on('afteredit', this.onAddRecord, this);
this.editor.on('canceledit', this.onEditCancelled, this);*/
this.nameField = new Ext.form.TextField({
allowBlank: false
});
this.chartResultChkBox = new Ext.form.Checkbox({
name: 'chartResult',
allowBlank: false,
anchor: "99%"
});
this.autoEmailChkBox = new Ext.form.Checkbox({
name: 'autoEmailAfterVerification',
allowBlank: false,
anchor: "99%"
});
this.isDefaultChkBox = new Ext.form.Checkbox({
name: 'isDefault',
allowBlank: false,
anchor: "99%"
});
this.isUrgentCBox = new Ext.form.Checkbox({
name: 'isUrgent',
allowBlank: false,
anchor: "99%"
});
this.isOrderedIndependentlyCBox = new Ext.form.Checkbox({
name: 'isOrderedIndependently',
allowBlank: false,
anchor: "99%"
});
this.allowMultipleOrdersCBox = new Ext.form.Checkbox({
name: 'allowMultipleOrders',
allowBlank: false,
anchor: "99%"
});
this.isPrimaryComponentCBox = new Ext.form.Checkbox({
name: 'isPrimaryComponent',
allowBlank: false,
anchor: "99%"
});
this.testResultTypeCBox = new Ext.form.ComboBox({
store: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: './labTest/listResultType'
}),
baseParams: {
searchTarget: 'Lab Test',
searchIsActive: true
},
reader: new Ext.data.JsonReader({
root: 'records',
totalProperty: 'totalCount',
id: 'id'
}, [{
name: 'id'
}, {
name: 'name'
}]),
remoteSort: true
}),
valueField: 'name',
displayField: 'name',
mode: 'remote',
triggerAction: 'all',
editable: false,
allowBlank: false,
fieldLabel: 'Result Type',
anchor: "99%",
listeners: {
beforequery: function (qe) {
delete qe.combo.lastQuery;
},
select: function (combo, record, index) {
this.editor.record.data.resultTypeId = record.data.id;
},
scope: this
}
});
this.labTestCategoryCBox = new Ext.form.ComboBox({
store: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: './labTestCategory/list'
}),
reader: new Ext.data.JsonReader({
root: 'records',
totalProperty: 'totalCount',
id: 'id'
}, [{
name: 'id'
}, {
name: 'name'
}]),
remoteSort: true
}),
valueField: 'id',
displayField: 'name',
mode: 'remote',
triggerAction: 'all',
editable: false,
allowBlank: false,
listWidth: 200,
listeners: {
beforequery: function (qe) {
delete qe.combo.lastQuery;
},
select: function (combo, record, index) {
this.editor.record.data.labTestCategoryId = record.data.id;
},
scope: this
}
});
this.orderSequenceField = new Ext.form.NumberField({
allowBlank: false,
value: 0
});
this.processingTimeField = new Ext.form.NumberField({
//name: 'processingTime',
allowBlank: true,
allowDecimal: true,
minValue: 0,
width: 75,
emptyText: 'Enter time here',
enableKeyEvents: true,
listeners: {
keyup: function (field, event) {
this.editor.record.data.processingTime = field.getValue();
this.editor.record.data.processingTimeCombined = field.getValue();
},
scope: this
}
});
this.processingHoursCBox = new Ext.form.ComboBox({
hiddenName: 'processingHours',
store: new Ext.data.SimpleStore({
fields: ['name'],
data: [['Absolute'], ['Working']]
}),
valueField: 'name',
displayField: 'name',
editable: false,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
allowBlank: true,
width: 75,
listeners: {
select: {
fn: function (combo, record, index) {
this.editor.record.data.processingHourType = record.data.name;
this.editor.record.data.processingTimeCombined = record.data.name;
},
scope: this
}
}
});
this.autoCalcField = new Ext.form.TextField({
allowBlank: true,
width: 75,
emptyText: 'Enter formula here',
enableKeyEvents: true,
listeners: {
keyup: function (field, event) {
this.editor.record.data.autoCalculationFormulae = field.getValue();
this.editor.record.data.autoCalculationFormulaeCombined = field.getValue();
},
scope: this
}
});
this.autoCalcSuppressField = new Ext.form.TextField({
allowBlank: true,
width: 75,
emptyText: 'Suppress configuration here',
enableKeyEvents: true,
listeners: {
keyup: function (field, event) {
this.editor.record.data.autoCalculationFormulaeSuppress = field.getValue();
this.editor.record.data.autoCalculationFormulaeCombined = field.getValue();
},
scope: this
}
});
onAddRecord: function (roweditor, changes, record, rowIndex) {
var data = record.data;
if (-1 !== this.treePanel.getSelectionModel().getSelectedNode().attributes.id) {
data.parentId = this.treePanel.getSelectionModel().getSelectedNode().attributes.id;
}
if (data.id) {
delete data.parentId;
}
Ext.Ajax.request({
url: './labTest/save',
method: 'POST',
params: data,
scope: this,
success: function (response) {
com.fortis.sanitas.GLOBALS.successPrompt(response);
this.treePanel.root.reload();
this.store.reload();
this.getSelectionModel().clearSelections();
},
failure: function (f, action) {
com.fortis.sanitas.GLOBALS.failedTransportAlert(action.response);
}
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment