Changeset 558 for trunk


Ignore:
Timestamp:
01/21/09 17:21:00 (15 years ago)
Author:
ramonb
Message:

web2/addons/job_monarch/js/jobgrid.js:

  • added changeable page size
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web2/addons/job_monarch/js/jobgrid.js

    r556 r558  
    66var myfilters = { };
    77var myparams = { };
     8var mylimit = 15;
    89var ClusterImageArgs = { };
    910
    1011var filterfields = [ "jid", "queue", "name", "owner" ];
     12
     13Ext.namespace('Ext.ux');
     14
     15Ext.ux.PageSizePlugin = function() {
     16    Ext.ux.PageSizePlugin.superclass.constructor.call(this, {
     17        store: new Ext.data.SimpleStore({
     18            fields: ['text', 'value'],
     19            data: [['10', 10], ['15', 15], ['20', 20], ['30', 30], ['50', 50], ['100', 100]]
     20        }),
     21        mode: 'local',
     22        displayField: 'text',
     23        valueField: 'value',
     24        editable: false,
     25        allowBlank: false,
     26        triggerAction: 'all',
     27        width: 40
     28    });
     29};
     30
     31Ext.extend(Ext.ux.PageSizePlugin, Ext.form.ComboBox, {
     32    init: function(paging) {
     33        paging.on('render', this.onInitView, this);
     34    },
     35   
     36    onInitView: function(paging) {
     37        paging.add('-',
     38            this,
     39            'jobs per page'
     40        );
     41        this.setValue(paging.pageSize);
     42        this.on('select', this.onPageSizeChanged, paging);
     43    },
     44   
     45    onPageSizeChanged: function(combo) {
     46        this.pageSize = parseInt(combo.getValue());
     47        mylimit = parseInt(combo.getValue());
     48        this.doLoad(0);
     49    }
     50});
     51
     52Ext.namespace( 'Ext' );
    1153
    1254function makeArrayURL( somearr )
     
    111153  // Can't be sure if there are enough pages for new filter: reset to page 1
    112154  //
    113   myparams = joinMyArray( myparams, { start: 0, limit: 30 } );
     155  //myparams = joinMyArray( myparams, { start: 0, limit: 30 } );
     156  //mylimit = JobListingEditorGrid.bbar.pageSize;
     157  myparams = joinMyArray( myparams, { start: 0, limit: mylimit } );
    114158
    115159  JobsDataStore.reload( { params: myparams } );
     
    202246}
    203247
     248Ext.apply(Ext.form.VTypes, {
     249        num: function(val, field) {
     250
     251                if (val) {
     252                   var strValidChars = "0123456789";
     253                   var blnResult = true;
     254
     255                   if (val.length == 0) return false;
     256
     257                   //  test strString consists of valid characters listed above
     258                   for (i = 0; i < val.length && blnResult == true; i++)
     259                      {
     260                      strChar = val.charAt(i);
     261                      if (strValidChars.indexOf(strChar) == -1)
     262                         {
     263                         blnResult = false;
     264                         }
     265                      }
     266                   return blnResult;
     267
     268                }
     269                },
     270        numText: 'Must be numeric'
     271});
     272
    204273function initJobGrid() {
    205274
    206275  Ext.QuickTips.init();
     276  Ext.form.Field.prototype.msgTarget = 'side';
    207277
    208278  function jobCellClick(grid, rowIndex, columnIndex, e)
     
    403473      stripeRows: true,
    404474      bbar: new Ext.PagingToolbar({
    405                 pageSize: 30,
     475                pageSize: 15,
    406476                store: JobsDataStore,
    407477                displayInfo: true,
    408478                displayMsg: 'Displaying jobs {0} - {1} out of {2} jobs total found.',
    409                 emptyMsg: 'No jobs found to display'
     479                emptyMsg: 'No jobs found to display',
     480                plugins: [new Ext.ux.PageSizePlugin()]
    410481            }),
    411482      tbar: [ new Ext.app.SearchField({
    412483                                store: JobsDataStore,
    413                                 params: {start: 0, limit: 30},
     484                                params: {start: 0, limit: mylimit},
    414485                                width: 200
    415486                    })
     
    434505                defaultText: 'Ready.',
    435506                id: 'basic-statusbar',
    436                 defaultIconCls: ''
     507                defaultIconCls: '',
    437508        })
    438509
Note: See TracChangeset for help on using the changeset viewer.