LSID generation for Study datasets | Anthony Corbett | 2012-05-18 14:04 |
Status: Closed | ||
Thanks Matt for the response. I now have a dummy visit (Sequence Number 101) setup just to hold progress notes with an additional auto-incremented key. I've take the visit off the overview so it looks like it doesn't exist in the study navigator. As a follow up to this I now have additional questions. I'm looking to add an LABKEY.ext.EditorGridPanel for progress notes to the Participant Overview (filtered by the current Participant being viewed in the overview). The javascript looks like this: /* get the participant id from the request URL: this parameter is required. */ var participantId = LABKEY.ActionURL.getParameter('participantId'); var _grid; //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,noteType,CreatedBy/Email,notes', filterArray: [ LABKEY.Filter.create('ParticipantId', participantId) ] }), renderTo: 'grid', width: 1000, autoHeight: true, title: 'Progress Notes', editable: true }); }); My issue comes in when I try to customize what columns are showing and adding a new row when 'required' fields aren't showing. I'd like to hide the ParticipantId and SequenceNum columns, the but following two solutions don't work. 1. If I don't specify these columns when creating the store they won't be there. Howeevr if I then try adding a new row I get an error when it goes to the server to save that it needs both of those fields. 2. I specify the ParticipantId and SequenceNum columns in the store config but I remove them from the grid. The behavior is that validation fails as those are required fields (even though I can't see them) so it never tries to save the row and doesn't even give user feedback that validation failed. This seems correct as in the EditorGridPanel.js file the following is documented: /** * Saves all pending changes to the database. Note that if * the required fields for a given record does not have values, * that record will not be saved and will remain dirty until * values are supplied for all required fields. * @name saveChanges * @function * @memberOf LABKEY.ext.EditorGridPanel# */ saveChanges : function() { ... } I think I can work around this if I can hook in a listener on the store so when a new row is created or added I can autofill certain fields. I'd like to be able to autofill the following columns: ParticipantId (we already know that from the query param), Sequence Num should always be 101 (my dummy visit), Date with current date, Name is the email of the person creating the record (doesn't matter what I put in this column actually as it will be overriden by the server with the createdBy user) So, my two questions are: 1. How do I specify custom configuration to always hide the ParticipantId and SequenceNum columns? Is this columnModel metadata I can specify inline to override what is coming back from the query? 2. How can I get a listener on the store to auto fill row fields for new records? Thanks a ton! - Anthony |
||