EditorGridPanel and getFieldEditorConfig | Ben Bimber | 2010-07-26 09:54 |
Status: Closed | ||
hi matt, you're probably right on multi-line text. other other main difference is that getFieldEditor uses 'jsonType' instead of 'type'. jsonType is standardized across the various query APIs, while 'type' is not. in the future I expect that I'll be asking for improvements in getFieldEditor (it's a very useful component when creating data entry), so it would be nice to only need to make them once. on a related subject: .Form.formHelper also contains a method designed to get and track Ext stores. It serves a few purposes: 1. each store will have a unique ID. if a store was already created, labkey will use that one instead of making a new one. 2. it's called by getFieldEditor to populate select menus It is mainly called by getFieldEditor, but I think something along these lines is more broadly useful. Below is a modification I made to it, with some explanation of the rationale behind the ideas: EHR.ext.getLookupStore = function(c, uniqueName) { this.lookupStores = this.lookupStores || {}; //this code currently exists in .getFieldEditor. It seems like the right place is to put it here. // normalize lookup c.table = c.table || c.queryName; c.schema = c.schema || c.schemaName; c.view = c.view || c.viewName; c.container = c.container || c.containerPath || LABKEY.container.path; //you can optionally pass a 'uniqueName' for your store, which will be it's ID. if you omit that, one will be auto-created //currently the code to create your unique ID lives in getFieldEditor. it seems like that should be done here instead. if (typeof(uniqueName) != 'string') uniqueName = [c.schema,c.table,c.view,c.keyColumn,c.displayColumn].join('||'); var store = this.lookupStores[uniqueName]; if (!store) { var columns = []; if (c.keyColumn) columns.push(c.keyColumn); if (c.displayColumn && c.displayColumn != c.keyColumn) columns.push(c.displayColumn); //the existing code tries set c.columns='*' if you dont supply key/display columns //i dont think * actually is recognized by labkey. omitting 'columns' should do the exact same thing, right? if(columns.length) c.columns = columns.join(','); //might be kinda nice if we could supply Ext config to set additional properties of the Ext.data.Store. LAKBEY.ext.Store lets you do some at that, but overwrites the 'listeners' //property, among others. the best thing would be to modify LABKEY.ext.Store, but we could allow apply Ext properties after it's created in here. c.autoLoad = true; store = new LABKEY.ext.Store(c); this.lookupStores[uniqueName] = store; } return store; } |
||