source: trunk/web2/addons/job_monarch/js/jobgrid.js @ 535

Last change on this file since 535 was 535, checked in by ramonb, 16 years ago
  • add tooltips & runningtime
File size: 32.8 KB
Line 
1var JobsDataStore;
2var JobsColumnModel;
3var JobListingEditorGrid;
4var JobListingWindow;
5var JobProxy;
6
7Ext.onReady(function(){
8
9  Ext.QuickTips.init();
10
11  JobProxy = new Ext.data.HttpProxy({
12                url: 'jobstore.php?c=GINA Cluster',
13                method: 'POST'
14            });
15
16  JobsDataStore = new Ext.data.Store({
17      id: 'JobsDataStore',
18      proxy: JobProxy,
19      baseParams:{task: "LISTING"}, // this parameter is passed for any HTTP request
20      reader: new Ext.data.JsonReader({
21        root: 'results',
22        totalProperty: 'total',
23        id: 'id'
24      },[
25        {name: 'jid', type: 'int', mapping: 'jid'},
26        {name: 'status', type: 'string', mapping: 'status'},
27        {name: 'owner', type: 'string', mapping: 'owner'},
28        {name: 'queue', type: 'string', mapping: 'queue'},
29        {name: 'name', type: 'string', mapping: 'name'},
30        {name: 'requested_time', type: 'string', mapping: 'requested_time'},
31        //{name: 'requested_memory', type: 'string', mapping: 'requested_memory'},
32        {name: 'ppn', type: 'int', mapping: 'ppn'},
33        {name: 'nodect', type: 'int', mapping: 'nodect'},
34        {name: 'nodes', type: 'string', mapping: 'nodes'},
35        {name: 'queued_timestamp', type: 'string', mapping: 'queued_timestamp'},
36        {name: 'start_timestamp', type: 'string', mapping: 'start_timestamp'},
37        {name: 'runningtime', type: 'string', mapping: 'runningtime'}
38      ]),
39      sortInfo:{field: 'jid', direction: "ASC"}
40    });
41   
42  JobsColumnModel = new Ext.grid.ColumnModel(
43    [{
44        header: '#',
45        tooltip: 'Job id',
46        readOnly: true,
47        dataIndex: 'jid',
48        width: 50,
49        hidden: false
50      },{
51        header: 'S',
52        tooltip: 'Job status',
53        readOnly: true,
54        dataIndex: 'status',
55        width: 20,
56        hidden: false
57      },{
58        header: 'User',
59        tooltip: 'Owner of job',
60        readOnly: true,
61        dataIndex: 'owner',
62        width: 60,
63        hidden: false
64      },{
65        header: 'Queue',
66        tooltip: 'In which queue does this job reside',
67        readOnly: true,
68        dataIndex: 'queue',
69        width: 60,
70        hidden: false
71      },{
72        header: 'Name',
73        tooltip: 'Name of job',
74        readOnly: true,
75        dataIndex: 'name',
76        width: 100,
77        hidden: false
78      },{
79        header: 'Requested Time',
80        tooltip: 'Amount of requested time (wallclock)',
81        readOnly: true,
82        dataIndex: 'requested_time',
83        width: 100,
84        hidden: false
85      },{
86        header: 'Requested Memory',
87        tooltip: 'Amount of requested memory',
88        readOnly: true,
89        dataIndex: 'requested_memory',
90        width: 100,
91        hidden: true
92      },{
93        header: 'P',
94        tooltip: 'Number of processors per node (PPN)',
95        readOnly: true,
96        dataIndex: 'ppn',
97        width: 25,
98        hidden: false
99      },{
100        header: 'N',
101        tooltip: 'Number of nodes (hosts)',
102        readOnly: true,
103        dataIndex: 'nodect',
104        width: 25,
105        hidden: false
106      },{
107        header: 'Nodes',
108        readOnly: true,
109        dataIndex: 'nodes',
110        width: 100,
111        hidden: true
112      },{
113        header: 'Queued',
114        tooltip: 'At what time did this job enter the queue',
115        readOnly: true,
116        dataIndex: 'queued_timestamp',
117        width: 140,
118        hidden: false
119      },{
120        header: 'Started',
121        tooltip: 'At what time did this job enter the running status',
122        readOnly: true,
123        dataIndex: 'start_timestamp',
124        width: 140,
125        hidden: false
126      },{
127        header: 'Runningtime',
128        tooltip: 'How long has this job been in the running status',
129        readOnly: true,
130        dataIndex: 'runningtime',
131        width: 140,
132        hidden: false
133      }]
134    );
135    JobsColumnModel.defaultSortable= true;
136
137  JobListingEditorGrid =  new Ext.grid.EditorGridPanel({
138      id: 'JobListingEditorGrid',
139      store: JobsDataStore,
140      cm: JobsColumnModel,
141      enableColLock:false,
142      clicksToEdit:1,
143      selModel: new Ext.grid.RowSelectionModel({singleSelect:false})
144    });
145
146function debug(){ 
147JobListingEditorGrid.addListener({
148
149        /**
150         * activate : ( Ext.Panel p )
151         * Fires after the Panel has been visually activated. Note that
152         * Panels do not directly support being activated, but some Panel
153         * subclasses do (like Ext.Window). Panels which are child
154         * Components of a TabPanel fire the activate and deactivate events
155         * under the control of the TabPanel.
156         * Listeners will be called with the following arguments:
157         * p : Ext.Panel
158         *     The Panel that has been activated.
159         */
160         'activate':{
161                fn: function(panel){
162                        console.log('Grid listener fired (activate), arguments:',arguments);
163                }
164                ,scope:this
165        }
166
167        /**
168         * add : ( Ext.Container this, Ext.Component component, Number index )
169         * Fires after any Ext.Component is added or inserted into the container.
170         * Listeners will be called with the following arguments:
171         * this : Ext.Container
172         * component : Ext.Component
173         *     The component that was added
174         * index : Number
175         *     The index at which the component was added to the container's items collection
176         */
177        ,'add':{
178                fn: function(container, component, index){
179                        console.log('Grid listener fired (add), arguments:',arguments);
180                }
181                ,scope:this
182        }
183
184        /**
185         * afteredit : ( Object e )
186         * Fires after a cell is edited.
187                 * grid - This grid
188         * record - The record being edited
189         * field - The field name being edited
190         * value - The value being set
191         * originalValue - The original value for the field, before the edit.
192         * row - The grid row index
193         * column - The grid column index
194         *
195         * Listeners will be called with the following arguments:
196         * e : Object
197         *              An edit event (see above for description)
198         */
199        ,'afteredit':{
200                fn: function(event){
201                        console.log('Grid listener fired (afteredit), arguments:',arguments);
202                }
203                ,scope:this
204        }
205
206        /**
207         * afterlayout : ( Ext.Container this, ContainerLayout layout )
208         * Fires when the components in this container are arranged by the
209         * associated layout manager. Listeners will be called with the
210         * following arguments:
211             * this : Ext.Container
212     * layout : ContainerLayout
213     *          The ContainerLayout implementation for this container
214         */
215        ,'afterlayout':{
216                fn: function(container, layout){
217                        console.log('Grid listener fired (afterlayout), arguments:',arguments);
218                }
219                ,scope:this
220        }
221
222        /**
223         * beforeadd : ( Ext.Container this, Ext.Component component, Number index )
224         * Fires before any Ext.Component is added or inserted into the
225         * container. A handler can return false to cancel the add.
226         * Listeners will be called with the following arguments:
227         * this : Ext.Container
228         * component : Ext.Component
229         *              The component being added
230         * index : Number
231         *              The index at which the component will be added to the
232         *              container's items collection
233         */
234        ,'beforeadd':{
235                fn: function(container, component, index){
236                        console.log('Grid listener fired (beforeadd), arguments:',arguments);
237                }
238                ,scope:this
239        }
240
241        /**
242         * beforeadd : ( Ext.Container this, Ext.Component component, Number index )
243         * Fires before any Ext.Component is added or inserted into the
244         * container. A handler can return false to cancel the add.
245         * Listeners will be called with the following arguments:
246         * this : Ext.Container
247         * component : Ext.Component
248         *              The component being added
249         * index : Number
250         *              The index at which the component will be added to the
251         *              container's items collection
252         */
253        ,'beforeadd':{
254                fn: function(container, component, index){
255                        console.log('Grid listener fired (beforeadd), arguments:',arguments);
256                }
257                ,scope:this
258        }
259
260        /**
261         * beforeclose : ( Ext.Panel p )
262         * Fires before the Panel is closed. Note that Panels do not
263         * directly support being closed, but some Panel subclasses do
264         * (like Ext.Window). This event only applies to such subclasses. A
265         * handler can return false to cancel the close.
266         * Listeners will be called with the following arguments:
267         * p : Ext.Panel
268         *              The Panel being closed.
269         */
270        ,'beforeclose':{
271                fn: function(panel){
272                        console.log('Grid listener fired (beforeclose), arguments:',arguments);
273                }
274                ,scope:this
275        }
276
277        /**
278         * beforecollapse : ( Ext.Panel p, Boolean animate )
279         * Fires before the Panel is collapsed. A handler can return
280         * false to cancel the collapse.
281         * Listeners will be called with the following arguments:
282         * p : Ext.Panel
283         *              the Panel being collapsed.
284         * animate : Boolean
285         *              True if the collapse is animated, else false.
286         */
287        ,'beforecollapse':{
288                fn: function(panel, animate){
289                        console.log('Grid listener fired (beforecollapse), arguments:',arguments);
290                }
291                ,scope:this
292        }
293
294        /**
295         * beforedestroy : ( Ext.Component this )
296         * Fires before the component is destroyed. Return false to stop
297         * the destroy.
298         * Listeners will be called with the following arguments:
299         * this : Ext.Component
300         */
301        ,'beforedestroy':{
302                fn: function(component){
303                        console.log('Grid listener fired (beforedestroy), arguments:',arguments);
304                }
305                ,scope:this
306        }
307
308        /**
309         * beforeedit : ( Object e )
310         * Fires before cell editing is triggered. The edit event object
311         * has the following properties
312         * grid - This grid
313         * record - The record being edited
314         * field - The field name being edited
315         * value - The value for the field being edited.
316         * row - The grid row index
317         * column - The grid column index
318         * cancel - Set this to true to cancel the edit or return false
319         * from your handler.
320         *
321         * Listeners will be called with the following arguments:
322         * e : Object
323         *              An edit event (see above for description)
324         */
325        ,'beforeedit':{
326                fn: function(event){
327                        console.log('Grid listener fired (beforeedit), arguments:',arguments);
328                }
329                ,scope:this
330        }
331
332        /**
333         * beforeexpand : ( Ext.Panel p, Boolean animate
334         * Fires before the Panel is expanded. A handler can return false to cancel the expand.
335         * Listeners will be called with the following arguments:
336         * p : Ext.Panel
337         * The Panel being expanded.
338         * animate : Boolean
339         * True if the expand is animated, else false.
340         */
341        ,'beforeexpand':{
342                fn: function(panel, animate){
343                        console.log('Grid listener fired (beforeexpand), arguments:',arguments);
344                }
345                ,scope:this
346        }
347
348        /**
349         * beforehide : ( Ext.Component this )
350         * Fires before the component is hidden. Return false to stop the hide.
351         * Listeners will be called with the following arguments:
352         * this : Ext.Component
353         */
354        ,'beforehide':{
355                fn: function(component){
356                        console.log('Grid listener fired (beforehide), arguments:',arguments);
357                }
358                ,scope:this
359        }
360
361        /**
362         * beforeremove : ( Ext.Container this, Ext.Component component )
363         * Fires before any Ext.Component is removed from the container. A handler
364         * an return false to cancel the remove.
365         * Listeners will be called with the following arguments:
366         * this : Ext.Container
367         * component : Ext.Component
368         * The component being removed
369         */
370        ,'beforeremove':{
371                fn: function(container, component){
372                        console.log('Grid listener fired (beforeremove), arguments:',arguments);
373                }
374                ,scope:this
375        }
376
377        /**
378         * beforerender : ( Ext.Component this )
379         * Fires before the component is rendered. Return false to stop the render.
380         * Listeners will be called with the following arguments:
381         * this : Ext.Component
382         */
383        ,'beforerender':{
384                fn: function(component){
385                        console.log('04 - Grid listener fired (beforerender), arguments:',arguments);
386                }
387                ,scope:this
388        }
389
390        /**
391         * beforeshow : ( Ext.Component this )
392         * Fires before the component is shown. Return false to stop the show.
393         * Listeners will be called with the following arguments:
394         * this : Ext.Component
395         */
396        ,'beforeshow':{
397                fn: function(component){
398                        console.log('Grid listener fired (beforeshow), arguments:',arguments);
399                }
400                ,scope:this
401        }
402
403        /**
404         * beforestaterestore : ( Ext.Component this, Object state )
405         * Fires before the state of the component is restored. Return false to stop the restore.
406         * Listeners will be called with the following arguments:
407         * this : Ext.Component
408         * state : Object
409         * The hash of state values
410         */
411        ,'beforestaterestore':{
412                fn: function(component, state){
413                        console.log('Grid listener fired (beforestaterestore), arguments:',arguments);
414                }
415                ,scope:this
416        }
417
418        /**
419         * beforestatesave : ( Ext.Component this, Object state )
420         * Fires before the state of the component is saved to the configured
421         * state provider. Return false to stop the save.
422         * Listeners will be called with the following arguments:
423         * this : Ext.Component
424         * state : Object
425         * The hash of state values
426         */
427        ,'beforestatesave':{
428                fn: function(component, state){
429                        console.log('Grid listener fired (beforestatesave), arguments:',arguments);
430                }
431                ,scope:this
432        }
433
434        /**
435         * bodyresize : ( Ext.Panel p, Number width, Number height )
436         * Fires after the Panel has been resized.
437         * Listeners will be called with the following arguments:
438         * p : Ext.Panel
439         * the Panel which has been resized.
440         * width : Number
441         * The Panel's new width.
442         * height : Number
443         * The Panel's new height.
444         */
445        ,'bodyresize':{
446                fn: function(panel, width, height){
447                        console.log('08 - Grid listener fired (bodyresize), arguments:',arguments);
448                }
449                ,scope:this
450        }
451
452        /**
453         * bodyscroll : ( Number scrollLeft, Number scrollTop )
454         * Fires when the body element is scrolled
455         * Listeners will be called with the following arguments:
456         * scrollLeft : Number
457         * scrollTop : Number
458         */
459        ,'bodyscroll':{
460                fn: function(scrollLeft, scrollTop){
461                        console.log('Grid listener fired (bodyscroll), arguments:',arguments);
462                }
463                ,scope:this
464        }
465
466        /**
467         * cellclick : ( Grid this, Number rowIndex, Number columnIndex, Ext.EventObject e )
468         * Fires when a cell is clicked. The data for the cell is drawn from the
469         * Record for this row. To access the data in the listener function use the
470         * following technique:
471         * function(grid, rowIndex, columnIndex, e) {
472         *      var record = grid.getStore().getAt(rowIndex);  // Get the Record
473         *  var fieldName = grid.getColumnModel().getDataIndex(columnIndex); // Get field name
474         *  var data = record.get(fieldName);
475         * }
476         * Listeners will be called with the following arguments:
477         * this : Grid
478         * rowIndex : Number
479         * columnIndex : Number
480         * e : Ext.EventObject
481         */
482        ,'cellclick':{
483                fn: function(grid, rowIndex, columnIndex, event){
484                        console.log('Grid listener fired (cellclick), arguments:',arguments);
485                }
486                ,scope:this
487        }
488
489        /**
490         * cellcontextmenu : ( Grid this, Number rowIndex, Number cellIndex, Ext.EventObject e )
491         * Fires when a cell is right clicked
492         * Listeners will be called with the following arguments:
493         * rowIndex : Number
494         * cellIndex : Number
495         * e : Ext.EventObject
496         */
497        ,'cellcontextmenu':{
498                fn: function(grid, rowIndex, cellIndex, event){
499                        console.log('Grid listener fired (cellcontextmenu), arguments:',arguments);
500                }
501                ,scope:this
502        }
503
504        /**
505         * celldblclick : ( Grid this, Number rowIndex, Number columnIndex, Ext.EventObject e )
506         * Fires when a cell is double clicked
507         * Listeners will be called with the following arguments:
508         * this : Grid
509         * rowIndex : Number
510         * columnIndex : Number
511         * e : Ext.EventObject
512         */
513        ,'celldblclick':{
514                fn: function(grid, rowIndex, columnIndex, event){
515                        console.log('Grid listener fired (celldblclick), arguments:',arguments);
516                }
517                ,scope:this
518        }
519
520        /**
521         * cellmousedown : ( Grid this, Number rowIndex, Number columnIndex, Ext.EventObject e )
522         * Fires before a cell is clicked
523         * Listeners will be called with the following arguments:
524         * this : Grid
525         * rowIndex : Number
526         * columnIndex : Number
527         * e : Ext.EventObject
528         */
529        ,'cellmousedown':{
530                fn: function(grid, rowIndex, columnIndex, event){
531                        console.log('Grid listener fired (cellmousedown), arguments:',arguments);
532                }
533                ,scope:this
534        }
535
536        /**
537         * click : ( Ext.EventObject e )
538         * The raw click event for the entire grid.
539         * Listeners will be called with the following arguments:
540         * e : Ext.EventObject
541         */
542        ,'click':{
543                fn: function(event){
544                        console.log('Grid listener fired (click), arguments:',arguments);
545                }
546                ,scope:this
547        }
548
549        /**
550         * close : ( Ext.Panel p )
551         * Fires after the Panel is closed. Note that Panels do not directly support being closed, but some Panel subclasses do (like Ext.Window).
552         * Listeners will be called with the following arguments:
553         * p : Ext.Panel
554         * The Panel that has been closed.
555         */
556        ,'close':{
557                fn: function(panel){
558                        console.log('Grid listener fired (close), arguments:',arguments);
559                }
560                ,scope:this
561        }
562
563        /**
564         * collapse : ( Ext.Panel p )
565         * Fires after the Panel has been collapsed.
566         * Listeners will be called with the following arguments:
567         *  p : Ext.Panel
568         * the Panel that has been collapsed.
569         */
570        ,'collapse':{
571                fn: function(panel){
572                        console.log('Grid listener fired (collapse), arguments:',arguments);
573                }
574                ,scope:this
575        }
576
577        /**
578         * columnmove : ( Number oldIndex, Number newIndex )
579         * Fires when the user moves a column
580         * Listeners will be called with the following arguments:
581         * oldIndex : Number
582         * newIndex : Number
583         */
584        ,'columnmove':{
585                fn: function(oldIndex, newIndex){
586                        console.log('Grid listener fired (columnmove), arguments:',arguments);
587                }
588                ,scope:this
589        }
590
591        /**
592         * columnresize : ( Number columnIndex, Number newSize )
593         * Fires when the user resizes a column
594         * Listeners will be called with the following arguments:
595         * columnIndex : Number
596         * newSize : Number
597         */
598        ,'columnresize':{
599                fn: function(columnIndex, newSize){
600                        console.log('Grid listener fired (columnresize), arguments:',arguments);
601                }
602                ,scope:this
603        }
604
605        /**
606         * contextmenu : ( Ext.EventObject e )
607         * The raw contextmenu event for the entire grid.
608         * Listeners will be called with the following arguments:
609         * e : Ext.EventObject         
610         */
611        ,'contextmenu':{
612                fn: function(event){
613                        console.log('Grid listener fired (contextmenu), arguments:',arguments);
614                }
615                ,scope:this
616        }
617
618        /**
619         * dblclick : ( Ext.EventObject e )
620         * The raw dblclick event for the entire grid.
621         * Listeners will be called with the following arguments:
622         * e : Ext.EventObject
623         */
624        ,'dblclick':{
625                fn: function(event){
626                        console.log('Grid listener fired (dblclick), arguments:',arguments);
627                }
628                ,scope:this
629        }
630
631        /**
632         * deactivate : ( Ext.Panel p )
633         * Fires after the Panel has been visually deactivated. Note that Panels do not directly support being deactivated, but some Panel subclasses do (like Ext.Window). Panels which are child Components of a TabPanel fire the activate and deactivate events under the control of the TabPanel.
634         * Listeners will be called with the following arguments:
635         * p : Ext.Panel
636         * The Panel that has been deactivated.
637         */
638        ,'deactivate':{
639                fn: function(panel){
640                        console.log('Grid listener fired (deactivate), arguments:',arguments);
641                }
642                ,scope:this
643        }
644
645        /**
646         * destroy : ( Ext.Component this )
647         * Fires after the component is destroyed.
648         * Listeners will be called with the following arguments:
649         * this : Ext.Component
650         */
651        ,'destroy':{
652                fn: function(component){
653                        console.log('Grid listener fired (destroy), arguments:',arguments);
654                }
655                ,scope:this
656        }
657
658        /**
659         * disable : ( Ext.Component this )
660         * Fires after the component is disabled.
661         * Listeners will be called with the following arguments:
662         * this : Ext.Component
663         */
664        ,'disable':{
665                fn: function(component){
666                        console.log('Grid listener fired (disable), arguments:',arguments);
667                }
668                ,scope:this
669        }
670
671        /**
672         * enable : ( Ext.Component this )
673         * Fires after the component is enabled.
674         * Listeners will be called with the following arguments:
675         * this : Ext.Component
676         */
677        ,'enable':{
678                fn: function(component){
679                        console.log('Grid listener fired (enable), arguments:',arguments);
680                }
681                ,scope:this
682        }
683
684        /**
685         * expand : ( Ext.Panel p )
686         * Fires after the Panel has been expanded.
687         * Listeners will be called with the following arguments:
688         * p : Ext.Panel
689         * The Panel that has been expanded.
690         */
691        ,'expand':{
692                fn: function(panel){
693                        console.log('Grid listener fired (expand), arguments:',arguments);
694                }
695                ,scope:this
696        }
697
698        /**
699         * headerclick : ( Grid this, Number columnIndex, Ext.EventObject e )
700         * Fires when a header is clicked
701         * Listeners will be called with the following arguments:
702         * this : Grid
703         * columnIndex : Number
704         * e : Ext.EventObject
705         */
706        ,'headerclick':{
707                fn: function(grid, columnIndex, event){
708                        console.log('Grid listener fired (headerclick), arguments:',arguments);
709                }
710                ,scope:this
711        }
712
713        /**
714         * headercontextmenu : ( Grid this, Number columnIndex, Ext.EventObject e )
715         * Fires when a header is right clicked
716         * Listeners will be called with the following arguments:
717         * this : Grid
718         * columnIndex : Number
719         * e : Ext.EventObject
720         */
721        ,'headercontextmenu':{
722                fn: function(grid, columnIndex, event){
723                        console.log('Grid listener fired (headercontextmenu), arguments:',arguments);
724                }
725                ,scope:this
726        }
727
728        /**
729         * headerdblclick : ( Grid this, Number columnIndex, Ext.EventObject e )
730         * Fires when a header cell is double clicked
731         * Listeners will be called with the following arguments:
732         * this : Grid
733         * columnIndex : Number
734         * e : Ext.EventObject
735         */
736        ,'headerdblclick':{
737                fn: function(grid, columnIndex, event){
738                        console.log('Grid listener fired (headerdblclick), arguments:',arguments);
739                }
740                ,scope:this
741        }
742
743        /**
744         * headermousedown : ( Grid this, Number columnIndex, Ext.EventObject e )
745         * Fires before a header is clicked
746         * Listeners will be called with the following arguments:
747         * this : Grid
748         * columnIndex : Number
749         * e : Ext.EventObject
750         */
751        ,'headermousedown':{
752                fn: function(grid, columnIndex, event){
753                        console.log('Grid listener fired (headermousedown), arguments:',arguments);
754                }
755                ,scope:this
756        }
757
758        /**
759         * hide : ( Ext.Component this )
760         * Fires after the component is hidden.
761         * Listeners will be called with the following arguments:
762         * this : Ext.Component
763         */
764        ,'hide':{
765                fn: function(component){
766                        console.log('Grid listener fired (hide), arguments:',arguments);
767                }
768                ,scope:this
769        }
770
771        /**
772         * keydown : ( Ext.EventObject e )
773         * The raw keydown event for the entire grid.
774         * Listeners will be called with the following arguments:
775         * e : Ext.EventObject
776         */
777        ,'keydown':{
778                fn: function(event){
779                        console.log('Grid listener fired (keydown), arguments:',arguments);
780                }
781                ,scope:this
782        }
783
784        /**
785         * keypress : ( Ext.EventObject e )
786         * The raw keypress event for the entire grid.
787         * Listeners will be called with the following arguments:
788         * e : Ext.EventObject
789         */
790        ,'keypress':{
791                fn: function(event){
792                        console.log('Grid listener fired (keypress), arguments:',arguments);
793                }
794                ,scope:this
795        }
796
797        /**
798         * mousedown : ( Ext.EventObject e )
799         * The raw mousedown event for the entire grid.
800         * Listeners will be called with the following arguments:
801         * e : Ext.EventObject
802         */
803        ,'mousedown':{
804                fn: function(event){
805                        //console.log('Grid listener fired (mousedown), arguments:',arguments);
806                }
807                ,scope:this
808        }
809
810        /**
811         * mouseout : ( Ext.EventObject e )
812         * The raw mouseout event for the entire grid.
813         * Listeners will be called with the following arguments:
814         * e : Ext.EventObject
815         */
816        ,'mouseout':{
817                fn: function(event){
818                        //console.log('Grid listener fired (mouseout), arguments:',arguments);
819                }
820                ,scope:this
821        }
822
823        /**
824         * mouseover : ( Ext.EventObject e )
825         * The raw mouseover event for the entire grid.
826         * Listeners will be called with the following arguments:
827         * e : Ext.EventObject
828         */
829        ,'mouseover':{
830                fn: function(event){
831                        console.log('Grid listener fired (mouseover), arguments:',arguments);
832                }
833                ,scope:this
834        }
835
836        /**
837         * mouseup : ( Ext.EventObject e )
838         * The raw mouseup event for the entire grid.
839         * Listeners will be called with the following arguments:
840         * e : Ext.EventObject
841         */
842        ,'mouseup':{
843                fn: function(event){
844                        //console.log('Grid listener fired (mouseup), arguments:',arguments);
845                }
846                ,scope:this
847        }
848
849        /**
850         * move : ( Ext.Component this, Number x, Number y )
851         * Fires after the component is moved.
852         * Listeners will be called with the following arguments:
853         * this : Ext.Component
854         * x : Number
855         * The new x position
856         * y : Number
857         * The new y position
858         */
859        ,'move':{
860                fn: function(component, x, y){
861                        console.log('Grid listener fired (move), arguments:',arguments);
862                }
863                ,scope:this
864        }
865
866        /**
867         * remove : ( Ext.Container this, Ext.Component component )
868         * Fires after any Ext.Component is removed from the container.
869         * Listeners will be called with the following arguments:
870         * this : Ext.Container
871         * component : Ext.Component
872         * The component that was removed
873         */
874        ,'remove':{
875                fn: function(container, component){
876                        console.log('Grid listener fired (remove), arguments:',arguments);
877                }
878                ,scope:this
879        }
880
881        /**
882         * render : ( Ext.Component this )
883         * Fires after the component is rendered.
884         * Listeners will be called with the following arguments:
885         * this : Ext.Component
886         */
887        ,'render':{
888                fn: function(component){
889                        console.log('06 - Grid listener fired (render), arguments:',arguments);
890                }
891                ,scope:this
892        }
893
894        /**
895         * resize : ( Ext.Component this, Number adjWidth, Number adjHeight, Number rawWidth, Number rawHeight )
896         * Fires after the component is resized.
897         * Listeners will be called with the following arguments:
898         * this : Ext.Component
899         * adjWidth : Number
900         * The box-adjusted width that was set
901         * adjHeight : Number
902         * The box-adjusted height that was set
903         * rawWidth : Number
904         * The width that was originally specified
905         * rawHeight : Number
906         * The height that was originally specified
907         */
908        ,'resize':{
909                fn: function(component, adjWidth, adjHeight, rawWidth, rawHeight){
910                        console.log('09 - Grid listener fired (resize), arguments:',arguments);
911                }
912                ,scope:this
913        }
914
915        /**
916         * rowclick : ( Grid this, Number rowIndex, Ext.EventObject e )
917         * Fires when a row is clicked
918         * Listeners will be called with the following arguments:
919         * this : Grid
920         * rowIndex : Number
921         * e : Ext.EventObject
922         */
923        ,'rowclick':{
924                fn: function(grid, rowIndex, event){
925                        console.log('Grid listener fired (rowclick), arguments:',arguments);
926                }
927                ,scope:this
928        }
929
930        /**
931         * rowcontextmenu : ( Grid this, Number rowIndex, Ext.EventObject e )
932         * Fires when a row is right clicked
933         * Listeners will be called with the following arguments:
934         * this : Grid
935         * rowIndex : Number
936         * e : Ext.EventObject
937         */
938        ,'rowcontextmenu':{
939                fn: function(grid, rowIndex, event){
940                        console.log('Grid listener fired (rowcontextmenu), arguments:',arguments);
941                }
942                ,scope:this
943        }
944
945        /**
946         * rowdblclick : ( Grid this, Number rowIndex, Ext.EventObject e )
947         * Fires when a row is double clicked
948         * Listeners will be called with the following arguments:
949         * this : Grid
950         * rowIndex : Number
951         * e : Ext.EventObject 
952         */
953        ,'rowdblclick':{
954                fn: function(grid, rowIndex, event){
955                        console.log('Grid listener fired (rowdblclick), arguments:',arguments);
956                }
957                ,scope:this
958        }
959
960        /**
961         * rowmousedown : ( Grid this, Number rowIndex, Ext.EventObject e )
962         * Fires before a row is clicked
963         * Listeners will be called with the following arguments:
964         * this : Grid
965         * rowIndex : Number
966         * e : Ext.EventObject
967         */
968        ,'rowmousedown':{
969                fn: function(grid, rowIndex, event){
970                        console.log('Grid listener fired (rowmousedown), arguments:',arguments);
971                }
972                ,scope:this
973        }
974
975        /**
976         * show : ( Ext.Component this )
977         * Fires after the component is shown.
978         * Listeners will be called with the following arguments:
979         * this : Ext.Component
980         */
981        ,'show':{
982                fn: function(component){
983                        console.log('Grid listener fired (show), arguments:',arguments);
984                }
985                ,scope:this
986        }
987
988        /**
989         * sortchange : ( Grid this, Object sortInfo )
990         * Fires when the grid's store sort changes
991         * Listeners will be called with the following arguments:
992         * this : Grid
993         * sortInfo : Object
994         * An object with the keys field and direction
995         */
996        ,'sortchange':{
997                fn: function(grid, sortInfo){
998                        console.log('05 - Grid listener fired (sortchange), arguments:',arguments);
999                }
1000                ,scope:this
1001        }
1002
1003        /**
1004         * staterestore : ( Ext.Component this, Object state )
1005         * Fires after the state of the component is restored.
1006         * Listeners will be called with the following arguments:
1007         * this : Ext.Component
1008         * state : Object
1009         * The hash of state values
1010         */
1011        ,'staterestore':{
1012                fn: function(component, state){
1013                        console.log('Grid listener fired (staterestore), arguments:',arguments);
1014                }
1015                ,scope:this
1016        }
1017
1018        /**
1019         * statesave : ( Ext.Component this, Object state )
1020         * Fires after the state of the component is saved to the configured state provider.
1021         * Listeners will be called with the following arguments:
1022         * this : Ext.Component
1023         * state : Object
1024         * The hash of state values
1025         */
1026        ,'statesave':{
1027                fn: function(component, state){
1028                        console.log('Grid listener fired (statesave), arguments:',arguments);
1029                }
1030                ,scope:this
1031        }
1032
1033        /**
1034         * titlechange : ( Ext.Panel p, String The )
1035         * Fires after the Panel title has been set or changed.
1036         * Listeners will be called with the following arguments:
1037         * p : Ext.Panel
1038         * the Panel which has had its title changed.
1039         * The : String
1040         * new title.
1041         */
1042        ,'titlechange':{
1043                fn: function(panel, title){
1044                        console.log('07 - Grid listener fired (titlechange), arguments:',arguments);
1045                }
1046                ,scope:this
1047        }
1048
1049        /**
1050         * validateedit : ( Object e )
1051         * Fires after a cell is edited, but before the value is set in the record. Return false to cancel the change. The edit event object has the following properties
1052         * grid - This grid
1053         * record - The record being edited
1054         * field - The field name being edited
1055         * value - The value being set
1056         * originalValue - The original value for the field, before the edit.
1057         * row - The grid row index
1058         * column - The grid column index
1059         * cancel - Set this to true to cancel the edit or return false from your handler.
1060         * Listeners will be called with the following arguments:
1061         * e : Object
1062         * An edit event (see above for descriptio
1063         */
1064        ,'validateedit':{
1065                fn: function(e){
1066                        console.log('Grid listener fired (validateedit), arguments:',arguments);
1067                }
1068                ,scope:this
1069        }
1070       
1071});//end grid.addListener
1072
1073/**
1074 * Proxy Listeners
1075 * These listeners are not required but may be handy if you're
1076 * trying to debug your code or see how the process of loading
1077 * the store works.
1078 * I tried adding these as part of the constructor they would
1079 * not fire, but they do appear to work when I add them outside of
1080 * the constructor.
1081 */             
1082JobProxy.on({
1083         'beforeload':{
1084                fn: function(store, options){
1085                        console.log('02 - Proxy listener fired (beforeload), arguments:',arguments);
1086                }
1087                ,scope:this
1088        }
1089        ,'load':{
1090                fn: function(store, options){
1091                        console.log('Proxy listener fired (load), arguments:',arguments);
1092                }
1093                ,scope:this
1094        }
1095        ,'loadexception':{
1096                fn: function(store, options){
1097                        console.log('Proxy listener fired (loadexception), arguments:',arguments);
1098                }
1099                ,scope:this
1100        }
1101});
1102
1103/**
1104 * Ajax request listeners
1105 */
1106Ext.Ajax.on({
1107         //Fires before a network request is made to retrieve a data object:
1108         'beforerequest':{
1109                fn: function(connection, options){
1110                        console.log('03 - Ajax listener fired (beforerequest), arguments(connection, options):',arguments);
1111                }
1112                ,scope:this
1113        }
1114        //Fires if the request was successfully completed:
1115        ,'requestcomplete':{
1116                fn: function(connection, response, options){
1117                        console.log('10 - Ajax listener fired (requestcomplete), arguments(connection, response, options):',arguments);
1118                }
1119                ,scope:this
1120        }
1121        //Fires if an error HTTP status was returned from the server. See HTTP Status Code
1122        //Definitions for details of HTTP status codes:
1123        ,'requestexception':{
1124                fn: function(connection, response, options){
1125                        console.log('Ajax listener fired (requestexception), arguments:(connection, response, options)',arguments);
1126                }
1127                ,scope:this
1128        }
1129});
1130
1131/**
1132 * Adding listeners outside the constructor
1133 */
1134JobsDataStore.on({
1135        'load':{
1136                fn: function(store, records, options){
1137                        console.log('01 - Data Store listener fired (load), arguments:',arguments);
1138                        console.log('         this:',this);
1139                }
1140                ,scope:this
1141        }
1142        ,'loadexception':{
1143                fn: function(httpProxy, dataObject, args, exception){
1144                        console.log('** - Data Store listener fired (loadexception), arguments:',arguments);
1145                }
1146                ,scope:this
1147        }
1148
1149        //add remaining events for education:           
1150        ,'add':{
1151                fn: function(store, records, index){
1152                        console.log('Data Store listener fired (add), arguments:',arguments);
1153                }
1154                ,scope:this
1155        }
1156        ,'beforeload':{
1157                fn: function(store, options){
1158                        console.log('Data Store listener fired fired (beforeload), arguments:',arguments);
1159                }
1160                ,scope:this
1161        }
1162        ,'clear':{
1163                fn: function(store){
1164                        console.log('Data Store listener fired fired (clear), arguments:',arguments);
1165                }
1166                ,scope:this
1167        }
1168        ,'datachanged':{
1169                fn: function(store){
1170                        console.log('11 - Data Store listener fired fired (datachanged), arguments:',arguments);
1171                        console.log('       If you set a breakpoint here the entire grid will be rendered without data');
1172                        console.log('       ...about to "refresh" grid body');
1173                }
1174                ,scope:this
1175        }
1176        ,'remove':{
1177                fn: function(store, record, index){
1178                        console.log('Data Store listener fired fired (remove), arguments:',arguments);
1179                }
1180                ,scope:this
1181        }
1182        ,'update':{
1183                fn: function(store, record, operation){
1184                        console.log('Data Store listener fired fired (update), arguments:',arguments);
1185                }
1186                ,scope:this
1187        }
1188});
1189}
1190   
1191  JobListingWindow = new Ext.Window({
1192      id: 'JobListingWindow',
1193      title: 'Cluster Jobs Overview',
1194      closable:true,
1195      width:900,
1196      height:500,
1197      plain:true,
1198      layout: 'fit',
1199      items: JobListingEditorGrid
1200    });
1201
1202  //debug(); 
1203  //JobListingEditorGrid.store.url='jobstore.php?c=GINA Cluster';
1204  JobsDataStore.load();
1205  JobListingWindow.show();
1206 
1207});
Note: See TracBrowser for help on using the repository browser.