LSID generation for Study datasets | Anthony Corbett | 2012-05-21 13:55 |
Status: Closed | ||
Thanks Trent and Ben for the tips. I got this working on with your suggestions. In the end it modifies the columnModel like I wanted to be able to to hide the two columns where still auto populating them when a new record is added. See code below for reference: <script type="text/javascript"> /* get the participant id from the request URL: this parameter is required. */ var participantId = LABKEY.ActionURL.getParameter('participantId'); var _grid; function customizeColumnModel(colModel, index, c) { //Hide columns index.ParticipantId.hidden = true; index.SequenceNum.hidden = true; index.date.renderer = Ext.util.Format.dateRenderer('m\\/d\\/Y'); } function onAddProgressNote(store, records) { store.suspendEvents(); for (var i=0 ; i<records.length ; i++) { records[i].set('ParticipantId', participantId); records[i].set('SequenceNum', 101); records[i].set('date', new Date().format("Y/m/d") ); records[i].set('CreatedBy/Email', LABKEY.Security.currentUser.email); } store.resumeEvents(); } //Use the Ext.onReady() function to define what code should //be executed once the page is fully loaded. //you must use this if you supply a renderTo config property Ext.onReady(function(){ _grid = new LABKEY.ext.EditorGridPanel({ store: new LABKEY.ext.Store({ schemaName: 'study', queryName: 'progress_notes', columns: 'ParticipantId,SequenceNum,date,CreatedBy/Email,noteType,notes', filterArray: [ LABKEY.Filter.create('ParticipantId', participantId) ], sort: '-date', listeners: { add: onAddProgressNote } }), renderTo: 'grid', listeners: { columnmodelcustomize: customizeColumnModel }, width: 1000, autoHeight: false, height: 300, title: 'Progress Notes', editable: true, autoSave: false, enableFilters: true, enableColumnHide: false, firstEditableColumn: 5 //Start editing on the noteType column }); }); </script> Thanks so much! |
||