Panel.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. Ext.define('uas.view.grid.bigData.Panel', {
  2. extend: 'Ext.grid.Panel',
  3. xtype: 'big-data-grid',
  4. controller: 'bigdata',
  5. requires: [
  6. 'Ext.grid.filters.Filters',
  7. 'Ext.sparkline.Line',
  8. 'Ext.ux.rating.Picker'
  9. ],
  10. store: {
  11. type: 'big-data',
  12. remoteSort: true,
  13. autoLoad: true
  14. },
  15. columnLines: true,
  16. multiColumnSort: true,
  17. features: [{
  18. ftype : 'groupingsummary',
  19. groupHeaderTpl : '{name}',
  20. hideGroupedHeader : false,
  21. enableGroupingMenu : false
  22. }, {
  23. ftype: 'summary',
  24. dock: 'bottom'
  25. }],
  26. layout: 'border',
  27. split: true,
  28. lockedGridConfig: {
  29. title: 'Employees',
  30. header: false,
  31. collapsible: true,
  32. width: 325,
  33. minWidth: 290,
  34. forceFit: true
  35. },
  36. selModel: {
  37. type: 'checkboxmodel',
  38. checkOnly: true
  39. },
  40. columns:[{
  41. xtype: 'rownumberer',
  42. width: 120,
  43. sortable: false,
  44. locked: true,
  45. summaryType: 'count',
  46. summaryRenderer: function(value, summaryData, dataIndex) {
  47. return Ext.String.format('共有{0}条数据', value);
  48. }
  49. }, {
  50. text: 'Id',
  51. sortable: true,
  52. dataIndex: 'employeeNo',
  53. groupable: false,
  54. width: 80,
  55. locked: true,
  56. editRenderer: 'bold'
  57. }, {
  58. text: 'Name (Filter)',
  59. dataIndex: 'name',
  60. sortable: true,
  61. sorter: {
  62. sorterFn: 'nameSorter' // set controller
  63. },
  64. width: 140,
  65. groupable: false,
  66. layout: 'hbox',
  67. locked: true,
  68. renderer: 'concatNames',
  69. editor: {
  70. xtype: 'textfield'
  71. },
  72. items: {
  73. xtype: 'textfield',
  74. fieldStyle: "",
  75. reference: 'nameFilterField',
  76. flex : 1,
  77. margin: 2,
  78. enableKeyEvents: true,
  79. listeners: {
  80. keyup: 'onNameFilterKeyup',
  81. buffer: 500
  82. }
  83. }
  84. }, {
  85. text: 'Rating',
  86. width: 100,
  87. sortable: true,
  88. dataIndex: 'rating',
  89. groupable: false,
  90. xtype: 'widgetcolumn',
  91. widget: {
  92. xtype: 'sparklineline'
  93. }
  94. }, {
  95. text: 'Date of birth',
  96. dataIndex: 'dob',
  97. xtype: 'datecolumn',
  98. groupable: false,
  99. width: 115,
  100. filter: {
  101. },
  102. editor: {
  103. xtype: 'datefield'
  104. },
  105. exportStyle: {
  106. alignment: {
  107. horizontal: 'Right'
  108. },
  109. format: 'Long Date'
  110. }
  111. }, {
  112. text: 'Join date',
  113. dataIndex: 'joinDate',
  114. xtype: 'datecolumn',
  115. groupable: false,
  116. width: 120,
  117. filter: {
  118. },
  119. editor: {
  120. xtype: 'datefield'
  121. },
  122. exportStyle: {
  123. alignment: {
  124. horizontal: 'Right'
  125. },
  126. format: 'Long Date'
  127. }
  128. }, {
  129. text: 'Notice<br>period',
  130. dataIndex: 'noticePeriod',
  131. groupable: false,
  132. width: 115,
  133. filter: {
  134. type: 'list'
  135. },
  136. editor: {
  137. xtype: 'combobox',
  138. listeners: {
  139. beforerender: 'onBeforeRenderNoticeEditor'
  140. }
  141. }
  142. }, {
  143. text: 'Email address',
  144. dataIndex: 'email',
  145. width: 200,
  146. groupable: false,
  147. renderer: 'renderMailto',
  148. editor: {
  149. xtype: 'textfield'
  150. }
  151. }, {
  152. text: 'Department',
  153. dataIndex: 'department',
  154. hidden: true,
  155. hideable: false,
  156. filter: {
  157. type: 'list'
  158. }
  159. }, {
  160. text: 'Absences',
  161. shrinkWrap: true,
  162. columns: [{
  163. text: 'Illness',
  164. dataIndex: 'sickDays',
  165. width: 100,
  166. groupable: false,
  167. summaryType: 'sum',
  168. summaryFormatter: 'number("0")',
  169. filter: {
  170. },
  171. editor: {
  172. xtype: 'numberfield',
  173. decimalPrecision: 0
  174. }
  175. }, {
  176. text: 'Holidays',
  177. dataIndex: 'holidayDays',
  178. width: null, // Size column to title text
  179. groupable: false,
  180. summaryType: 'sum',
  181. summaryFormatter: 'number("0")',
  182. filter: {
  183. },
  184. editor: {
  185. xtype: 'numberfield',
  186. decimalPrecision: 0
  187. }
  188. }, {
  189. text: 'Holiday Allowance',
  190. dataIndex: 'holidayAllowance',
  191. width: null, // Size column to title text
  192. groupable: false,
  193. summaryType: 'sum',
  194. summaryFormatter: 'number("0.00")',
  195. formatter: 'number("0.00")',
  196. filter: {
  197. },
  198. editor: {
  199. xtype: 'numberfield',
  200. decimalPrecision: 0
  201. }
  202. }]
  203. }, {
  204. text: 'Rating<br>This Year',
  205. dataIndex: 'ratingThisYear',
  206. groupable: false,
  207. xtype: 'widgetcolumn',
  208. widget: {
  209. xtype: 'rating',
  210. tip: 'Set to {tracking:plural("Star")}'
  211. }
  212. }, {
  213. text: 'Salary',
  214. width: 155,
  215. sortable: true,
  216. dataIndex: 'salary',
  217. align: 'right',
  218. formatter: 'usMoney',
  219. groupable: false,
  220. summaryType: 'average',
  221. summaryFormatter: 'usMoney',
  222. filter: {
  223. },
  224. editor: {
  225. xtype: 'numberfield',
  226. decimalPrecision: 2
  227. },
  228. exportStyle: {
  229. alignment: {
  230. horizontal: 'Right'
  231. },
  232. format: 'Currency'
  233. }
  234. }],
  235. viewConfig: {
  236. stripeRows: true
  237. },
  238. plugins: {
  239. gridfilters: true,
  240. rowexpander: {
  241. // dblclick invokes the row editor
  242. expandOnDblClick: false,
  243. rowBodyTpl: '<img src="{avatar}" height="100px" '+
  244. 'style="float:left;margin:0 10px 5px 0"><b>{name}<br></b>{dob:date}'
  245. }
  246. }
  247. });