Changeset 546 for trunk/web2/addons/job_monarch/js
- Timestamp:
- 07/12/08 22:54:34 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web2/addons/job_monarch/js/jobgrid.js
r545 r546 4 4 var JobListingWindow; 5 5 var JobProxy; 6 var myfilters = { start: 0, limit: 30}; 6 var myfilters = { }; 7 var myparams = { }; 8 9 var filterfields = [ "jid", "queue", "name", "owner" ]; 10 11 function isset( somevar ) 12 { 13 try 14 { 15 if( eval( somevar ) ) { } 16 } 17 catch( err ) 18 { 19 return false; 20 } 21 return true; 22 } 23 24 function inMyArray( arr, someval ) 25 { 26 for( arval in arr ) 27 { 28 if( arval == someval ) 29 { 30 return true; 31 } 32 } 33 return false; 34 } 35 36 function inMyArrayValues( arr, someval ) 37 { 38 for( arkey in arr ) 39 { 40 if( arr[arkey] == someval ) 41 { 42 return true; 43 } 44 } 45 return false; 46 } 47 48 function inMyArrayKeys( arr, someval ) 49 { 50 for( arkey in arr ) 51 { 52 if( arkey == someval ) 53 { 54 return true; 55 } 56 } 57 return false; 58 } 59 60 function joinMyArray( arr1, arr2 ) 61 { 62 for( arkey in arr2 ) 63 { 64 arr1[arkey] = arr2[arkey]; 65 } 66 67 return arr1; 68 } 7 69 8 70 function initJobGrid() { … … 20 82 if( fieldName == 'owner' || fieldName == 'jid' || fieldName == 'status' || fieldName == 'queue' ) 21 83 { 22 if( myfilters[fieldName] != null)84 if( !isset( myfilters[fieldName] ) ) 23 85 { 24 86 Ext.fly(cell).removeClass( 'filterenabled' ); 25 87 Ext.fly(cell).addClass( 'filter' ); 26 88 89 // Remove this filter 90 // 27 91 delete myfilters[fieldName]; 28 29 grid.getStore().reload( {params: myfilters} ); 92 delete myparams[fieldName]; 93 94 // Respect any other parameters that may have been set outside filters 95 // 96 myparams = joinMyArray( myparams, myfilters ); 97 98 // Can't be sure if there are enough pages for new filter: reset to page 1 99 // 100 myparams = joinMyArray( myparams, { start: 0, limit: 30 } ); 101 102 grid.getStore().reload( { params: myparams } ); 30 103 } 31 104 else … … 34 107 Ext.fly(cell).addClass( 'filterenabled' ); 35 108 109 // Set filter for selected column to selected cell value 110 // 36 111 myfilters[fieldName] = data; 37 112 38 grid.getStore().reload( {params: myfilters} ); 113 myparams = joinMyArray( myparams, myfilters ); 114 myparams = joinMyArray( myparams, { start: 0, limit: 30 } ); 115 116 grid.getStore().reload( { params: myparams } ); 39 117 } 40 118 }
Note: See TracChangeset
for help on using the changeset viewer.