]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/js/dojo/openils/widget/EditDialog.js
added option to launch creation dialog from auto grid. passing final pcrud response...
[working/Evergreen.git] / Open-ILS / web / js / dojo / openils / widget / EditDialog.js
1 /**
2 var dialog = new openils.widget.EditDialog({
3     fmObject: survey,
4     fieldOrder: ['id', 'name', 'description', 'start_date', 'end_date']
5 });
6 dialog.startup();
7 dialog.show();
8 */
9
10
11
12 if(!dojo._hasResource['openils.widget.EditDialog']) {
13     dojo.provide('openils.widget.EditDialog');
14     dojo.require('openils.widget.EditPane');
15     dojo.require('dijit.Dialog');
16
17     /**
18      * Given a fieldmapper object, this builds a pop-up dialog used for editing the object
19      */
20
21     dojo.declare(
22         'openils.widget.EditDialog',
23         [dijit.Dialog],
24         {
25             editPane : null, // reference to our EditPane object
26
27             constructor : function(args) {
28                 this.editPane = new openils.widget.EditPane(args);
29                 var self = this;
30
31                 this.editPane.onCancel = function() { 
32                     if(args.onCancel)
33                         args.onCancel();
34                     self.hide(); 
35                 }
36
37                 this.editPane.onPostSubmit = function(r) { 
38                     self.hide(); 
39                     if(args.onPostSubmit)
40                         args.onPostSubmit(r);
41                 }
42             },
43
44             /**
45              * Builds a basic table of key / value pairs.  Keys are IDL display labels.
46              * Values are dijit's, when values set
47              */
48             startup : function() {
49                 this.inherited(arguments);
50                 this.editPane.startup();
51                 this.domNode.appendChild(this.editPane.domNode);
52             }
53         }
54     );
55 }
56