Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

235 lines
9.7 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. Ext.onReady(function(){
  8. Ext.QuickTips.init();
  9. var xg = Ext.grid;
  10. // shared reader
  11. var reader = new Ext.data.ArrayReader({}, [
  12. {name: 'company'},
  13. {name: 'price', type: 'float'},
  14. {name: 'change', type: 'float'},
  15. {name: 'pctChange', type: 'float'},
  16. {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'},
  17. {name: 'industry'},
  18. {name: 'desc'}
  19. ]);
  20. ////////////////////////////////////////////////////////////////////////////////////////
  21. // Grid 1
  22. ////////////////////////////////////////////////////////////////////////////////////////
  23. // row expander
  24. var expander = new Ext.ux.grid.RowExpander({
  25. tpl : new Ext.Template(
  26. '<p><b>Company:</b> {company}</p><br>',
  27. '<p><b>Summary:</b> {desc}</p>'
  28. )
  29. });
  30. var grid1 = new xg.GridPanel({
  31. store: new Ext.data.Store({
  32. reader: reader,
  33. data: xg.dummyData
  34. }),
  35. cm: new xg.ColumnModel({
  36. defaults: {
  37. width: 20,
  38. sortable: true
  39. },
  40. columns: [
  41. expander,
  42. {id:'company',header: "Company", width: 40, dataIndex: 'company'},
  43. {header: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
  44. {header: "Change", dataIndex: 'change'},
  45. {header: "% Change", dataIndex: 'pctChange'},
  46. {header: "Last Updated", renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
  47. ]
  48. }),
  49. viewConfig: {
  50. forceFit:true
  51. },
  52. width: 600,
  53. height: 300,
  54. plugins: expander,
  55. collapsible: true,
  56. animCollapse: false,
  57. title: 'Expander Rows, Collapse and Force Fit',
  58. iconCls: 'icon-grid',
  59. renderTo: document.body
  60. });
  61. ////////////////////////////////////////////////////////////////////////////////////////
  62. // Grid 2
  63. ////////////////////////////////////////////////////////////////////////////////////////
  64. var sm = new xg.CheckboxSelectionModel();
  65. var grid2 = new xg.GridPanel({
  66. store: new Ext.data.Store({
  67. reader: reader,
  68. data: xg.dummyData
  69. }),
  70. cm: new xg.ColumnModel({
  71. defaults: {
  72. width: 120,
  73. sortable: true
  74. },
  75. columns: [
  76. sm,
  77. {id:'company',header: "Company", width: 200, dataIndex: 'company'},
  78. {header: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
  79. {header: "Change", dataIndex: 'change'},
  80. {header: "% Change", dataIndex: 'pctChange'},
  81. {header: "Last Updated", width: 135, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
  82. ]
  83. }),
  84. sm: sm,
  85. columnLines: true,
  86. width:600,
  87. height:300,
  88. frame:true,
  89. title:'Framed with Checkbox Selection and Horizontal Scrolling',
  90. iconCls:'icon-grid',
  91. renderTo: document.body
  92. });
  93. ////////////////////////////////////////////////////////////////////////////////////////
  94. // Grid 3
  95. ////////////////////////////////////////////////////////////////////////////////////////
  96. var grid3 = new xg.GridPanel({
  97. store: new Ext.data.Store({
  98. reader: reader,
  99. data: xg.dummyData
  100. }),
  101. cm: new xg.ColumnModel([
  102. new xg.RowNumberer(),
  103. {id:'company',header: "Company", width: 40, sortable: true, dataIndex: 'company'},
  104. {header: "Price", width: 20, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
  105. {header: "Change", width: 20, sortable: true, dataIndex: 'change'},
  106. {header: "% Change", width: 20, sortable: true, dataIndex: 'pctChange'},
  107. {header: "Last Updated", width: 20, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
  108. ]),
  109. viewConfig: {
  110. forceFit:true
  111. },
  112. columnLines: true,
  113. width:600,
  114. height:300,
  115. title:'Grid with Numbered Rows and Force Fit',
  116. iconCls:'icon-grid',
  117. renderTo: document.body
  118. });
  119. ////////////////////////////////////////////////////////////////////////////////////////
  120. // Grid 4
  121. ////////////////////////////////////////////////////////////////////////////////////////
  122. var sm2 = new xg.CheckboxSelectionModel({
  123. listeners: {
  124. // On selection change, set enabled state of the removeButton
  125. // which was placed into the GridPanel using the ref config
  126. selectionchange: function(sm) {
  127. if (sm.getCount()) {
  128. grid4.removeButton.enable();
  129. } else {
  130. grid4.removeButton.disable();
  131. }
  132. }
  133. }
  134. });
  135. var grid4 = new xg.GridPanel({
  136. id:'button-grid',
  137. store: new Ext.data.Store({
  138. reader: reader,
  139. data: xg.dummyData
  140. }),
  141. cm: new xg.ColumnModel([
  142. sm2,
  143. {id:'company',header: "Company", width: 40, sortable: true, dataIndex: 'company'},
  144. {header: "Price", width: 20, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
  145. {header: "Change", width: 20, sortable: true, dataIndex: 'change'},
  146. {header: "% Change", width: 20, sortable: true, dataIndex: 'pctChange'},
  147. {header: "Last Updated", width: 20, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
  148. ]),
  149. sm: sm2,
  150. viewConfig: {
  151. forceFit:true
  152. },
  153. columnLines: true,
  154. // inline buttons
  155. buttons: [{text:'Save'},{text:'Cancel'}],
  156. buttonAlign:'center',
  157. // inline toolbars
  158. tbar:[{
  159. text:'Add Something',
  160. tooltip:'Add a new row',
  161. iconCls:'add'
  162. }, '-', {
  163. text:'Options',
  164. tooltip:'Blah blah blah blaht',
  165. iconCls:'option'
  166. },'-',{
  167. text:'Remove Something',
  168. tooltip:'Remove the selected item',
  169. iconCls:'remove',
  170. // Place a reference in the GridPanel
  171. ref: '../removeButton',
  172. disabled: true
  173. }],
  174. width:600,
  175. height:300,
  176. frame:true,
  177. title:'Support for standard Panel features such as framing, buttons and toolbars',
  178. iconCls:'icon-grid',
  179. renderTo: document.body
  180. });
  181. });
  182. // Array data for the grids
  183. Ext.grid.dummyData = [
  184. ['3m Co',71.72,0.02,0.03,'9/1 12:00am', 'Manufacturing'],
  185. ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am', 'Manufacturing'],
  186. ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am', 'Manufacturing'],
  187. ['American Express Company',52.55,0.01,0.02,'9/1 12:00am', 'Finance'],
  188. ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am', 'Services'],
  189. ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am', 'Services'],
  190. ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am', 'Manufacturing'],
  191. ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am', 'Services'],
  192. ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am', 'Finance'],
  193. ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am', 'Manufacturing'],
  194. ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am', 'Manufacturing'],
  195. ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am', 'Manufacturing'],
  196. ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am', 'Automotive'],
  197. ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am', 'Computer'],
  198. ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am', 'Manufacturing'],
  199. ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am', 'Computer'],
  200. ['International Business Machines',81.41,0.44,0.54,'9/1 12:00am', 'Computer'],
  201. ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am', 'Medical'],
  202. ['JP Morgan & Chase & Co',45.73,0.07,0.15,'9/1 12:00am', 'Finance'],
  203. ['McDonald\'s Corporation',36.76,0.86,2.40,'9/1 12:00am', 'Food'],
  204. ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am', 'Medical'],
  205. ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am', 'Computer'],
  206. ['Pfizer Inc',27.96,0.4,1.45,'9/1 12:00am', 'Services', 'Medical'],
  207. ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am', 'Food'],
  208. ['The Home Depot, Inc.',34.64,0.35,1.02,'9/1 12:00am', 'Retail'],
  209. ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am', 'Manufacturing'],
  210. ['United Technologies Corporation',63.26,0.55,0.88,'9/1 12:00am', 'Computer'],
  211. ['Verizon Communications',35.57,0.39,1.11,'9/1 12:00am', 'Services'],
  212. ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am', 'Retail'],
  213. ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am', 'Services']
  214. ];
  215. // add in some dummy descriptions
  216. for(var i = 0; i < Ext.grid.dummyData.length; i++){
  217. Ext.grid.dummyData[i].push('Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.<br/><br/>Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit.');
  218. }