Guest User

Untitled

a guest
Jan 18th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. this.jsonStore = new Ext.data.JsonStore({
  2. proxy : new Ext.data.HttpProxy({
  3. url: 'rs/environments',
  4. disableCaching: true
  5. }),
  6. restful : true,
  7. storeId : 'Environments',
  8. idProperty: 'env',
  9. fields : [
  10. 'ConnectionName', 'Type'
  11. ]
  12. });
  13.  
  14. this.colmodel = new Ext.grid.ColumnModel({
  15. defaults: {
  16. align: 'center'
  17. },
  18. columns: [{
  19. header: Accero.Locale.text.adminlogin.connectionsHeading,
  20. width : 140,
  21. dataIndex: 'ConnectionName'
  22. },
  23. {
  24. header: Accero.Locale.text.adminlogin.connectionTypeHeader,
  25. width : 120,
  26. dataIndex: 'Type'
  27. }]
  28. });
  29.  
  30. config = Ext.apply({
  31. enableHdMenu: false,
  32. border : true,
  33. stripeRows : true,
  34. store : this.jsonStore,
  35. view : new Ext.grid.GridView(),
  36. header : false,
  37. colModel : this.colmodel,
  38. sm : new Ext.grid.RowSelectionModel({singleSelect: true}),
  39. loadMask: {
  40. msg: Accero.Locale.text.adminlogin.loadingmask
  41. }
  42. }, config);
  43.  
  44. var sm = new Ext.selection.CheckboxModel( {
  45. listeners:{
  46. selectionchange: function(selectionModel, selected, options){
  47. // Must refresh the view after every selection
  48. myGrid.getView().refresh();
  49. // other code for this listener
  50. }
  51. }
  52. });
  53.  
  54. var getSelectedSumFn = function(column){
  55. return function(){
  56. var records = myGrid.getSelectionModel().getSelection(),
  57. result = 0;
  58. Ext.each(records, function(record){
  59. result += record.get(column) * 1;
  60. });
  61. return result;
  62. };
  63. }
  64.  
  65.  
  66. var config = Ext.create('Ext.grid.Panel', {
  67. autoScroll:true,
  68. features: [{
  69. ftype: 'summary'
  70. }],
  71. store: this.jsonStore,
  72. defaults: { // defaults are applied to items, not the container
  73. sortable:true
  74. },
  75. selModel: sm,
  76. columns: [
  77. {header: Accero.Locale.text.adminlogin.connectionsHeading, width: 140, dataIndex: 'ConnectionName'},
  78. {header: Accero.Locale.text.adminlogin.connectionTypeHeader, width: 120, dataIndex: 'Type'}
  79. ],
  80. loadMask: {
  81. msg: Accero.Locale.text.adminlogin.loadingmask
  82. },
  83. viewConfig: {
  84. stripeRows: true
  85. }
  86. }, config);
  87.  
  88. (function() {
  89. var originalInitValue = Ext.form.TextField.prototype.initValue;
  90. Ext.override(Ext.form.TextField, {
  91. initValue: function() {
  92. originalInitValue.apply( this, arguments );
  93. if (!isNaN(this.maxLength) && (this.maxLength *1) > 0 && (this.maxLength != Number.MAX_VALUE)) {
  94. this.el.dom.maxLength = this.maxLength *1;
  95. }
  96. }
  97. }
  98. );
  99. })();
  100.  
  101. Ext.override('My.Override.for.TextField', {
  102. override : 'Ext.form.TextField',
  103. initValue: function() {
  104. this.callOverridden(arguments);
  105. if (!isNaN(this.maxLength) && (this.maxLength *1) > 0 && (this.maxLength != Number.MAX_VALUE)) {
  106. this.el.dom.maxLength = this.maxLength *1;
  107. }
  108. }
  109. });
  110.  
  111. Ext.override('My.Override.for.TextField', {
  112. override : 'Ext.form.TextField',
  113. afterRender: function() {
  114. this.callOverridden(arguments);
  115. if (!isNaN(this.maxLength) && (this.maxLength *1) > 0 && (this.maxLength != Number.MAX_VALUE)) {
  116. this.el.dom.maxLength = this.maxLength *1;
  117. }
  118. }
  119. });
Add Comment
Please, Sign In to add comment