Skip to content

Instantly share code, notes, and snippets.

@jratcliff
jratcliff / Protocol.js
Created August 10, 2016 20:37
Protocol
Ext.define('ProtoManagement.model.studyprotocol.Protocol', {
extend: 'ProtoManagement.model.Base',
requires: [
'Ext.data.validator.Presence',
'ProtoManagement.model.StudySection',
'ProtoManagement.model.studyprotocol.Comment',
'ProtoManagement.model.studyprotocol.CurrentRevision',
'ProtoManagement.model.studyprotocol.Revision',
'ProtoManagement.model.studyprotocol.StudyCode',
@jratcliff
jratcliff / ModelOverride.js
Last active April 18, 2018 19:39
Ext.data.Model overrides for nested/keyless associations in 6.x
/**
* Overrides for Ext.data.Model
*/
Ext.define('overrides.data.Model', {
override: 'Ext.data.Model',
privates: {
/**
* Override that adds support to check associations
*/
@jratcliff
jratcliff / WriterOverride.js
Last active January 31, 2017 19:19
Ext.data.writer.Writer override
/**
* Overrides for Ext.data.writer.Writer
*/
Ext.define('overrides.data.writer.Writer', {
override: 'Ext.data.writer.Writer',
/**
* Override that allows the 'serialize' option to be honored if it is passed
* in the allDataOptions or partialDataOptions configs of a writer's config.
* JIRA: EXTJS-17166
@jratcliff
jratcliff / JsonReaderOverride.js
Last active April 24, 2018 20:35
overrides for Ext.data.reader.Json
Ext.define('overrides.data.Reader.Json', {
override: 'Ext.data.reader.Json',
/**
* Override that makes sure to first delete the existing store so that keyless associations
* can be reloaded when their parent record is reloaded.
* JIRA: EXTJS-21175
*/
readAssociated: function(record, data, readOptions) {
var roles = record.associations,
/**
* Overrides for Ext.data.schema.Role
*/
Ext.define('overrides.data.schema.Role', {
override: 'Ext.data.schema.Role',
/**
* The default field name that gets updated with the current time when
* an associated record changes. This can be changed by configuring this
* on the record that has the 'useAssociationEditPropagation' config set to true.
@jratcliff
jratcliff / Text.js
Last active July 16, 2020 22:04
TextField override that makes sure the emptyText displays when grow: true is used on a field
Ext.define(null, {
override: 'Ext.form.field.Text',
/**
* Override that makes sure to display the emptyText
* and adds the padding and margin of the inputEl
*/
autoSize: function () {
var me = this,
triggers, triggerId, triggerWidth, inputEl, width, value;
@jratcliff
jratcliff / Combo.js
Last active July 17, 2020 17:38
Override that fixes a few things when calculating the min width of a combo's input field.
Ext.define(null, {
override: 'Ext.form.field.ComboBox',
/**
* Override that fixes a few things when calculating the min width of a combo's input field.
*
* First, if a display field is not used but instead a displayTpl, then this override handles that
* Also includes the 'emptyText' in case it is longer than the currently selected text
*/
getGrowWidth: function() {