gridx-rails 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (518) hide show
  1. checksums.yaml +15 -0
  2. data/LICENSE +2 -0
  3. data/README.md +18 -0
  4. data/Rakefile +36 -0
  5. data/app/assets/images/gridx/mobile/themes/iphone/images/ajax-loader.gif +0 -0
  6. data/app/assets/images/gridx/mobile/themes/iphone/images/arrow.png +0 -0
  7. data/app/assets/images/gridx/resources/images/checkboxpartial.png +0 -0
  8. data/app/assets/images/gridx/resources/images/checkboxpartialdisabled.png +0 -0
  9. data/app/assets/images/gridx/resources/images/claro-grid-header-onepixel.bmp +0 -0
  10. data/app/assets/images/gridx/resources/images/dndCopy.png +0 -0
  11. data/app/assets/images/gridx/resources/images/dndMove.png +0 -0
  12. data/app/assets/images/gridx/resources/images/dndNoCopy.png +0 -0
  13. data/app/assets/images/gridx/resources/images/dndNoMove.png +0 -0
  14. data/app/assets/images/gridx/resources/images/gridxCellChanged.png +0 -0
  15. data/app/assets/images/gridx/resources/images/header.png +0 -0
  16. data/app/assets/images/gridx/resources/images/header_shadow.png +0 -0
  17. data/app/assets/images/gridx/resources/images/loadingAnimation.gif +0 -0
  18. data/app/assets/images/gridx/resources/images/row_back.png +0 -0
  19. data/app/assets/images/gridx/resources/images/row_back_changed.png +0 -0
  20. data/app/assets/images/gridx/resources/images/sprite_icons.png +0 -0
  21. data/app/assets/images/gridx/resources/images/treeExpandImages.png +0 -0
  22. data/app/assets/images/gridx/resources/images/treeExpand_loading.gif +0 -0
  23. data/app/assets/javascripts/gridx/Grid.js +224 -0
  24. data/app/assets/javascripts/gridx/GridCommon.js +52 -0
  25. data/app/assets/javascripts/gridx/allModules.js +105 -0
  26. data/app/assets/javascripts/gridx/core/Cell.js +86 -0
  27. data/app/assets/javascripts/gridx/core/Column.js +183 -0
  28. data/app/assets/javascripts/gridx/core/Core.js +447 -0
  29. data/app/assets/javascripts/gridx/core/Row.js +174 -0
  30. data/app/assets/javascripts/gridx/core/_Module.js +285 -0
  31. data/app/assets/javascripts/gridx/core/model/Model.js +495 -0
  32. data/app/assets/javascripts/gridx/core/model/_Extension.js +84 -0
  33. data/app/assets/javascripts/gridx/core/model/cache/Async.js +469 -0
  34. data/app/assets/javascripts/gridx/core/model/cache/Sync.js +59 -0
  35. data/app/assets/javascripts/gridx/core/model/cache/_Cache.js +386 -0
  36. data/app/assets/javascripts/gridx/core/model/extensions/ClientFilter.js +303 -0
  37. data/app/assets/javascripts/gridx/core/model/extensions/FormatSort.js +103 -0
  38. data/app/assets/javascripts/gridx/core/model/extensions/Mark.js +370 -0
  39. data/app/assets/javascripts/gridx/core/model/extensions/Modify.js +418 -0
  40. data/app/assets/javascripts/gridx/core/model/extensions/Move.js +429 -0
  41. data/app/assets/javascripts/gridx/core/model/extensions/Query.js +50 -0
  42. data/app/assets/javascripts/gridx/core/model/extensions/Sort.js +81 -0
  43. data/app/assets/javascripts/gridx/core/util.js +13 -0
  44. data/app/assets/javascripts/gridx/mobile/Grid.js +300 -0
  45. data/app/assets/javascripts/gridx/mobile/LazyLoad.js +88 -0
  46. data/app/assets/javascripts/gridx/mobile/PullRefresh.js +117 -0
  47. data/app/assets/javascripts/gridx/mobile/Sort.js +66 -0
  48. data/app/assets/javascripts/gridx/mobile/nls/LazyLoad.js +38 -0
  49. data/app/assets/javascripts/gridx/mobile/nls/PullRefresh.js +39 -0
  50. data/app/assets/javascripts/gridx/mobile/nls/ar/LazyLoad.js +6 -0
  51. data/app/assets/javascripts/gridx/mobile/nls/ar/PullRefresh.js +7 -0
  52. data/app/assets/javascripts/gridx/mobile/nls/ar/common.js +5 -0
  53. data/app/assets/javascripts/gridx/mobile/nls/bg/LazyLoad.js +6 -0
  54. data/app/assets/javascripts/gridx/mobile/nls/bg/PullRefresh.js +7 -0
  55. data/app/assets/javascripts/gridx/mobile/nls/bg/common.js +5 -0
  56. data/app/assets/javascripts/gridx/mobile/nls/ca/LazyLoad.js +6 -0
  57. data/app/assets/javascripts/gridx/mobile/nls/ca/PullRefresh.js +7 -0
  58. data/app/assets/javascripts/gridx/mobile/nls/ca/common.js +5 -0
  59. data/app/assets/javascripts/gridx/mobile/nls/common.js +37 -0
  60. data/app/assets/javascripts/gridx/mobile/nls/cs/LazyLoad.js +6 -0
  61. data/app/assets/javascripts/gridx/mobile/nls/cs/PullRefresh.js +7 -0
  62. data/app/assets/javascripts/gridx/mobile/nls/cs/common.js +5 -0
  63. data/app/assets/javascripts/gridx/mobile/nls/da/LazyLoad.js +6 -0
  64. data/app/assets/javascripts/gridx/mobile/nls/da/PullRefresh.js +7 -0
  65. data/app/assets/javascripts/gridx/mobile/nls/da/common.js +5 -0
  66. data/app/assets/javascripts/gridx/mobile/nls/de/LazyLoad.js +6 -0
  67. data/app/assets/javascripts/gridx/mobile/nls/de/PullRefresh.js +7 -0
  68. data/app/assets/javascripts/gridx/mobile/nls/de/common.js +5 -0
  69. data/app/assets/javascripts/gridx/mobile/nls/el/LazyLoad.js +6 -0
  70. data/app/assets/javascripts/gridx/mobile/nls/el/PullRefresh.js +7 -0
  71. data/app/assets/javascripts/gridx/mobile/nls/el/common.js +5 -0
  72. data/app/assets/javascripts/gridx/mobile/nls/es/LazyLoad.js +6 -0
  73. data/app/assets/javascripts/gridx/mobile/nls/es/PullRefresh.js +7 -0
  74. data/app/assets/javascripts/gridx/mobile/nls/es/common.js +5 -0
  75. data/app/assets/javascripts/gridx/mobile/nls/fi/LazyLoad.js +6 -0
  76. data/app/assets/javascripts/gridx/mobile/nls/fi/PullRefresh.js +7 -0
  77. data/app/assets/javascripts/gridx/mobile/nls/fi/common.js +5 -0
  78. data/app/assets/javascripts/gridx/mobile/nls/fr/LazyLoad.js +6 -0
  79. data/app/assets/javascripts/gridx/mobile/nls/fr/PullRefresh.js +7 -0
  80. data/app/assets/javascripts/gridx/mobile/nls/fr/common.js +5 -0
  81. data/app/assets/javascripts/gridx/mobile/nls/he/LazyLoad.js +6 -0
  82. data/app/assets/javascripts/gridx/mobile/nls/he/PullRefresh.js +7 -0
  83. data/app/assets/javascripts/gridx/mobile/nls/he/common.js +5 -0
  84. data/app/assets/javascripts/gridx/mobile/nls/hr/LazyLoad.js +6 -0
  85. data/app/assets/javascripts/gridx/mobile/nls/hr/PullRefresh.js +7 -0
  86. data/app/assets/javascripts/gridx/mobile/nls/hr/common.js +5 -0
  87. data/app/assets/javascripts/gridx/mobile/nls/hu/LazyLoad.js +6 -0
  88. data/app/assets/javascripts/gridx/mobile/nls/hu/PullRefresh.js +7 -0
  89. data/app/assets/javascripts/gridx/mobile/nls/hu/common.js +5 -0
  90. data/app/assets/javascripts/gridx/mobile/nls/it/LazyLoad.js +6 -0
  91. data/app/assets/javascripts/gridx/mobile/nls/it/PullRefresh.js +7 -0
  92. data/app/assets/javascripts/gridx/mobile/nls/it/common.js +5 -0
  93. data/app/assets/javascripts/gridx/mobile/nls/ja/LazyLoad.js +6 -0
  94. data/app/assets/javascripts/gridx/mobile/nls/ja/PullRefresh.js +7 -0
  95. data/app/assets/javascripts/gridx/mobile/nls/ja/common.js +5 -0
  96. data/app/assets/javascripts/gridx/mobile/nls/kk/LazyLoad.js +6 -0
  97. data/app/assets/javascripts/gridx/mobile/nls/kk/PullRefresh.js +7 -0
  98. data/app/assets/javascripts/gridx/mobile/nls/kk/common.js +5 -0
  99. data/app/assets/javascripts/gridx/mobile/nls/ko/LazyLoad.js +6 -0
  100. data/app/assets/javascripts/gridx/mobile/nls/ko/PullRefresh.js +7 -0
  101. data/app/assets/javascripts/gridx/mobile/nls/ko/common.js +5 -0
  102. data/app/assets/javascripts/gridx/mobile/nls/nb/LazyLoad.js +6 -0
  103. data/app/assets/javascripts/gridx/mobile/nls/nb/PullRefresh.js +7 -0
  104. data/app/assets/javascripts/gridx/mobile/nls/nb/common.js +5 -0
  105. data/app/assets/javascripts/gridx/mobile/nls/nl/LazyLoad.js +6 -0
  106. data/app/assets/javascripts/gridx/mobile/nls/nl/PullRefresh.js +7 -0
  107. data/app/assets/javascripts/gridx/mobile/nls/nl/common.js +5 -0
  108. data/app/assets/javascripts/gridx/mobile/nls/pl/LazyLoad.js +6 -0
  109. data/app/assets/javascripts/gridx/mobile/nls/pl/PullRefresh.js +7 -0
  110. data/app/assets/javascripts/gridx/mobile/nls/pl/common.js +5 -0
  111. data/app/assets/javascripts/gridx/mobile/nls/pt/LazyLoad.js +6 -0
  112. data/app/assets/javascripts/gridx/mobile/nls/pt/PullRefresh.js +7 -0
  113. data/app/assets/javascripts/gridx/mobile/nls/pt/common.js +5 -0
  114. data/app/assets/javascripts/gridx/mobile/nls/pt-pt/LazyLoad.js +6 -0
  115. data/app/assets/javascripts/gridx/mobile/nls/pt-pt/PullRefresh.js +7 -0
  116. data/app/assets/javascripts/gridx/mobile/nls/pt-pt/common.js +5 -0
  117. data/app/assets/javascripts/gridx/mobile/nls/ro/LazyLoad.js +6 -0
  118. data/app/assets/javascripts/gridx/mobile/nls/ro/PullRefresh.js +7 -0
  119. data/app/assets/javascripts/gridx/mobile/nls/ro/common.js +5 -0
  120. data/app/assets/javascripts/gridx/mobile/nls/ru/LazyLoad.js +6 -0
  121. data/app/assets/javascripts/gridx/mobile/nls/ru/PullRefresh.js +7 -0
  122. data/app/assets/javascripts/gridx/mobile/nls/ru/common.js +5 -0
  123. data/app/assets/javascripts/gridx/mobile/nls/sk/LazyLoad.js +6 -0
  124. data/app/assets/javascripts/gridx/mobile/nls/sk/PullRefresh.js +7 -0
  125. data/app/assets/javascripts/gridx/mobile/nls/sk/common.js +5 -0
  126. data/app/assets/javascripts/gridx/mobile/nls/sl/LazyLoad.js +6 -0
  127. data/app/assets/javascripts/gridx/mobile/nls/sl/PullRefresh.js +7 -0
  128. data/app/assets/javascripts/gridx/mobile/nls/sl/common.js +5 -0
  129. data/app/assets/javascripts/gridx/mobile/nls/sv/LazyLoad.js +6 -0
  130. data/app/assets/javascripts/gridx/mobile/nls/sv/PullRefresh.js +7 -0
  131. data/app/assets/javascripts/gridx/mobile/nls/sv/common.js +5 -0
  132. data/app/assets/javascripts/gridx/mobile/nls/th/LazyLoad.js +6 -0
  133. data/app/assets/javascripts/gridx/mobile/nls/th/PullRefresh.js +7 -0
  134. data/app/assets/javascripts/gridx/mobile/nls/th/common.js +5 -0
  135. data/app/assets/javascripts/gridx/mobile/nls/tr/LazyLoad.js +6 -0
  136. data/app/assets/javascripts/gridx/mobile/nls/tr/PullRefresh.js +7 -0
  137. data/app/assets/javascripts/gridx/mobile/nls/tr/common.js +5 -0
  138. data/app/assets/javascripts/gridx/mobile/nls/uk/LazyLoad.js +6 -0
  139. data/app/assets/javascripts/gridx/mobile/nls/uk/PullRefresh.js +7 -0
  140. data/app/assets/javascripts/gridx/mobile/nls/uk/common.js +5 -0
  141. data/app/assets/javascripts/gridx/mobile/nls/zh/LazyLoad.js +6 -0
  142. data/app/assets/javascripts/gridx/mobile/nls/zh/PullRefresh.js +7 -0
  143. data/app/assets/javascripts/gridx/mobile/nls/zh/common.js +5 -0
  144. data/app/assets/javascripts/gridx/mobile/nls/zh-tw/LazyLoad.js +6 -0
  145. data/app/assets/javascripts/gridx/mobile/nls/zh-tw/PullRefresh.js +7 -0
  146. data/app/assets/javascripts/gridx/mobile/nls/zh-tw/common.js +5 -0
  147. data/app/assets/javascripts/gridx/modules/AutoScroll.js +100 -0
  148. data/app/assets/javascripts/gridx/modules/Bar.js +322 -0
  149. data/app/assets/javascripts/gridx/modules/Body.js +1059 -0
  150. data/app/assets/javascripts/gridx/modules/CellWidget.js +538 -0
  151. data/app/assets/javascripts/gridx/modules/ColumnLock.js +254 -0
  152. data/app/assets/javascripts/gridx/modules/ColumnResizer.js +278 -0
  153. data/app/assets/javascripts/gridx/modules/ColumnWidth.js +320 -0
  154. data/app/assets/javascripts/gridx/modules/Dod.js +368 -0
  155. data/app/assets/javascripts/gridx/modules/Edit.js +1024 -0
  156. data/app/assets/javascripts/gridx/modules/Filter.js +482 -0
  157. data/app/assets/javascripts/gridx/modules/Focus.js +439 -0
  158. data/app/assets/javascripts/gridx/modules/GroupHeader.js +437 -0
  159. data/app/assets/javascripts/gridx/modules/HLayout.js +139 -0
  160. data/app/assets/javascripts/gridx/modules/HScroller.js +172 -0
  161. data/app/assets/javascripts/gridx/modules/Header.js +289 -0
  162. data/app/assets/javascripts/gridx/modules/HeaderMenu.js +63 -0
  163. data/app/assets/javascripts/gridx/modules/HeaderRegions.js +201 -0
  164. data/app/assets/javascripts/gridx/modules/HiddenColumns.js +274 -0
  165. data/app/assets/javascripts/gridx/modules/IndirectSelect.js +287 -0
  166. data/app/assets/javascripts/gridx/modules/IndirectSelectColumn.js +277 -0
  167. data/app/assets/javascripts/gridx/modules/Menu.js +167 -0
  168. data/app/assets/javascripts/gridx/modules/NavigableCell.js +170 -0
  169. data/app/assets/javascripts/gridx/modules/NestedSort.js +280 -0
  170. data/app/assets/javascripts/gridx/modules/PagedBody.js +409 -0
  171. data/app/assets/javascripts/gridx/modules/Pagination.js +293 -0
  172. data/app/assets/javascripts/gridx/modules/Persist.js +266 -0
  173. data/app/assets/javascripts/gridx/modules/Printer.js +49 -0
  174. data/app/assets/javascripts/gridx/modules/RowHeader.js +412 -0
  175. data/app/assets/javascripts/gridx/modules/RowLock.js +143 -0
  176. data/app/assets/javascripts/gridx/modules/SingleSort.js +276 -0
  177. data/app/assets/javascripts/gridx/modules/SummaryBar.js +33 -0
  178. data/app/assets/javascripts/gridx/modules/TitleBar.js +51 -0
  179. data/app/assets/javascripts/gridx/modules/ToolBar.js +55 -0
  180. data/app/assets/javascripts/gridx/modules/TouchScroll.js +103 -0
  181. data/app/assets/javascripts/gridx/modules/TouchVScroller.js +89 -0
  182. data/app/assets/javascripts/gridx/modules/Traverse.js +159 -0
  183. data/app/assets/javascripts/gridx/modules/Tree.js +646 -0
  184. data/app/assets/javascripts/gridx/modules/VLayout.js +152 -0
  185. data/app/assets/javascripts/gridx/modules/VScroller.js +342 -0
  186. data/app/assets/javascripts/gridx/modules/View.js +540 -0
  187. data/app/assets/javascripts/gridx/modules/VirtualVScroller.js +445 -0
  188. data/app/assets/javascripts/gridx/modules/barPlugins/DropDownPager.js +16 -0
  189. data/app/assets/javascripts/gridx/modules/barPlugins/DropDownSizer.js +16 -0
  190. data/app/assets/javascripts/gridx/modules/barPlugins/GotoPageButton.js +16 -0
  191. data/app/assets/javascripts/gridx/modules/barPlugins/LinkPager.js +16 -0
  192. data/app/assets/javascripts/gridx/modules/barPlugins/LinkSizer.js +16 -0
  193. data/app/assets/javascripts/gridx/modules/barPlugins/Summary.js +16 -0
  194. data/app/assets/javascripts/gridx/modules/dnd/Avatar.js +45 -0
  195. data/app/assets/javascripts/gridx/modules/dnd/Column.js +210 -0
  196. data/app/assets/javascripts/gridx/modules/dnd/Row.js +286 -0
  197. data/app/assets/javascripts/gridx/modules/dnd/_Base.js +60 -0
  198. data/app/assets/javascripts/gridx/modules/dnd/_Dnd.js +371 -0
  199. data/app/assets/javascripts/gridx/modules/exporter/CSV.js +43 -0
  200. data/app/assets/javascripts/gridx/modules/exporter/Exporter.js +34 -0
  201. data/app/assets/javascripts/gridx/modules/exporter/Table.js +42 -0
  202. data/app/assets/javascripts/gridx/modules/extendedSelect/Cell.js +491 -0
  203. data/app/assets/javascripts/gridx/modules/extendedSelect/Column.js +290 -0
  204. data/app/assets/javascripts/gridx/modules/extendedSelect/Row.js +458 -0
  205. data/app/assets/javascripts/gridx/modules/extendedSelect/_Base.js +244 -0
  206. data/app/assets/javascripts/gridx/modules/extendedSelect/_RowCellBase.js +35 -0
  207. data/app/assets/javascripts/gridx/modules/filter/DistinctComboBoxMenu.js +22 -0
  208. data/app/assets/javascripts/gridx/modules/filter/Filter.js +16 -0
  209. data/app/assets/javascripts/gridx/modules/filter/FilterBar.js +649 -0
  210. data/app/assets/javascripts/gridx/modules/filter/FilterConfirmDialog.js +33 -0
  211. data/app/assets/javascripts/gridx/modules/filter/FilterDialog.js +179 -0
  212. data/app/assets/javascripts/gridx/modules/filter/FilterPane.js +340 -0
  213. data/app/assets/javascripts/gridx/modules/filter/FilterTooltip.js +103 -0
  214. data/app/assets/javascripts/gridx/modules/filter/QuickFilter.js +33 -0
  215. data/app/assets/javascripts/gridx/modules/move/Column.js +223 -0
  216. data/app/assets/javascripts/gridx/modules/move/Row.js +154 -0
  217. data/app/assets/javascripts/gridx/modules/pagination/Pagination.js +16 -0
  218. data/app/assets/javascripts/gridx/modules/pagination/PaginationBar.js +68 -0
  219. data/app/assets/javascripts/gridx/modules/pagination/PaginationBarDD.js +40 -0
  220. data/app/assets/javascripts/gridx/modules/pagination/_PaginationBarBase.js +105 -0
  221. data/app/assets/javascripts/gridx/modules/select/Cell.js +229 -0
  222. data/app/assets/javascripts/gridx/modules/select/Column.js +209 -0
  223. data/app/assets/javascripts/gridx/modules/select/Row.js +302 -0
  224. data/app/assets/javascripts/gridx/modules/select/_Base.js +99 -0
  225. data/app/assets/javascripts/gridx/modules/select/_RowCellBase.js +51 -0
  226. data/app/assets/javascripts/gridx/nls/Body.js +47 -0
  227. data/app/assets/javascripts/gridx/nls/FilterBar.js +133 -0
  228. data/app/assets/javascripts/gridx/nls/NestedSort.js +45 -0
  229. data/app/assets/javascripts/gridx/nls/PaginationBar.js +68 -0
  230. data/app/assets/javascripts/gridx/nls/QuickFilter.js +40 -0
  231. data/app/assets/javascripts/gridx/nls/SummaryBar.js +38 -0
  232. data/app/assets/javascripts/gridx/nls/ar/Body.js +11 -0
  233. data/app/assets/javascripts/gridx/nls/ar/FilterBar.js +89 -0
  234. data/app/assets/javascripts/gridx/nls/ar/NestedSort.js +11 -0
  235. data/app/assets/javascripts/gridx/nls/ar/PaginationBar.js +34 -0
  236. data/app/assets/javascripts/gridx/nls/ar/QuickFilter.js +7 -0
  237. data/app/assets/javascripts/gridx/nls/ar/SummaryBar.js +5 -0
  238. data/app/assets/javascripts/gridx/nls/bg/Body.js +11 -0
  239. data/app/assets/javascripts/gridx/nls/bg/FilterBar.js +88 -0
  240. data/app/assets/javascripts/gridx/nls/bg/NestedSort.js +12 -0
  241. data/app/assets/javascripts/gridx/nls/bg/PaginationBar.js +28 -0
  242. data/app/assets/javascripts/gridx/nls/bg/QuickFilter.js +8 -0
  243. data/app/assets/javascripts/gridx/nls/bg/SummaryBar.js +6 -0
  244. data/app/assets/javascripts/gridx/nls/ca/Body.js +11 -0
  245. data/app/assets/javascripts/gridx/nls/ca/FilterBar.js +89 -0
  246. data/app/assets/javascripts/gridx/nls/ca/NestedSort.js +13 -0
  247. data/app/assets/javascripts/gridx/nls/ca/PaginationBar.js +30 -0
  248. data/app/assets/javascripts/gridx/nls/ca/QuickFilter.js +9 -0
  249. data/app/assets/javascripts/gridx/nls/ca/SummaryBar.js +7 -0
  250. data/app/assets/javascripts/gridx/nls/cs/Body.js +11 -0
  251. data/app/assets/javascripts/gridx/nls/cs/FilterBar.js +89 -0
  252. data/app/assets/javascripts/gridx/nls/cs/NestedSort.js +11 -0
  253. data/app/assets/javascripts/gridx/nls/cs/PaginationBar.js +34 -0
  254. data/app/assets/javascripts/gridx/nls/cs/QuickFilter.js +7 -0
  255. data/app/assets/javascripts/gridx/nls/cs/SummaryBar.js +5 -0
  256. data/app/assets/javascripts/gridx/nls/da/Body.js +11 -0
  257. data/app/assets/javascripts/gridx/nls/da/FilterBar.js +89 -0
  258. data/app/assets/javascripts/gridx/nls/da/NestedSort.js +11 -0
  259. data/app/assets/javascripts/gridx/nls/da/PaginationBar.js +34 -0
  260. data/app/assets/javascripts/gridx/nls/da/QuickFilter.js +7 -0
  261. data/app/assets/javascripts/gridx/nls/da/SummaryBar.js +5 -0
  262. data/app/assets/javascripts/gridx/nls/de/Body.js +11 -0
  263. data/app/assets/javascripts/gridx/nls/de/FilterBar.js +89 -0
  264. data/app/assets/javascripts/gridx/nls/de/NestedSort.js +11 -0
  265. data/app/assets/javascripts/gridx/nls/de/PaginationBar.js +34 -0
  266. data/app/assets/javascripts/gridx/nls/de/QuickFilter.js +7 -0
  267. data/app/assets/javascripts/gridx/nls/de/SummaryBar.js +5 -0
  268. data/app/assets/javascripts/gridx/nls/el/Body.js +11 -0
  269. data/app/assets/javascripts/gridx/nls/el/FilterBar.js +89 -0
  270. data/app/assets/javascripts/gridx/nls/el/NestedSort.js +11 -0
  271. data/app/assets/javascripts/gridx/nls/el/PaginationBar.js +34 -0
  272. data/app/assets/javascripts/gridx/nls/el/QuickFilter.js +7 -0
  273. data/app/assets/javascripts/gridx/nls/el/SummaryBar.js +5 -0
  274. data/app/assets/javascripts/gridx/nls/es/Body.js +11 -0
  275. data/app/assets/javascripts/gridx/nls/es/FilterBar.js +89 -0
  276. data/app/assets/javascripts/gridx/nls/es/NestedSort.js +13 -0
  277. data/app/assets/javascripts/gridx/nls/es/PaginationBar.js +30 -0
  278. data/app/assets/javascripts/gridx/nls/es/QuickFilter.js +9 -0
  279. data/app/assets/javascripts/gridx/nls/es/SummaryBar.js +7 -0
  280. data/app/assets/javascripts/gridx/nls/fi/Body.js +11 -0
  281. data/app/assets/javascripts/gridx/nls/fi/FilterBar.js +89 -0
  282. data/app/assets/javascripts/gridx/nls/fi/NestedSort.js +11 -0
  283. data/app/assets/javascripts/gridx/nls/fi/PaginationBar.js +34 -0
  284. data/app/assets/javascripts/gridx/nls/fi/QuickFilter.js +7 -0
  285. data/app/assets/javascripts/gridx/nls/fi/SummaryBar.js +5 -0
  286. data/app/assets/javascripts/gridx/nls/fr/Body.js +11 -0
  287. data/app/assets/javascripts/gridx/nls/fr/FilterBar.js +89 -0
  288. data/app/assets/javascripts/gridx/nls/fr/NestedSort.js +11 -0
  289. data/app/assets/javascripts/gridx/nls/fr/PaginationBar.js +34 -0
  290. data/app/assets/javascripts/gridx/nls/fr/QuickFilter.js +7 -0
  291. data/app/assets/javascripts/gridx/nls/fr/SummaryBar.js +5 -0
  292. data/app/assets/javascripts/gridx/nls/he/Body.js +11 -0
  293. data/app/assets/javascripts/gridx/nls/he/FilterBar.js +89 -0
  294. data/app/assets/javascripts/gridx/nls/he/NestedSort.js +11 -0
  295. data/app/assets/javascripts/gridx/nls/he/PaginationBar.js +34 -0
  296. data/app/assets/javascripts/gridx/nls/he/QuickFilter.js +6 -0
  297. data/app/assets/javascripts/gridx/nls/he/SummaryBar.js +5 -0
  298. data/app/assets/javascripts/gridx/nls/hr/Body.js +11 -0
  299. data/app/assets/javascripts/gridx/nls/hr/FilterBar.js +89 -0
  300. data/app/assets/javascripts/gridx/nls/hr/NestedSort.js +11 -0
  301. data/app/assets/javascripts/gridx/nls/hr/PaginationBar.js +34 -0
  302. data/app/assets/javascripts/gridx/nls/hr/QuickFilter.js +7 -0
  303. data/app/assets/javascripts/gridx/nls/hr/SummaryBar.js +5 -0
  304. data/app/assets/javascripts/gridx/nls/hu/Body.js +11 -0
  305. data/app/assets/javascripts/gridx/nls/hu/FilterBar.js +89 -0
  306. data/app/assets/javascripts/gridx/nls/hu/NestedSort.js +11 -0
  307. data/app/assets/javascripts/gridx/nls/hu/PaginationBar.js +33 -0
  308. data/app/assets/javascripts/gridx/nls/hu/QuickFilter.js +7 -0
  309. data/app/assets/javascripts/gridx/nls/hu/SummaryBar.js +5 -0
  310. data/app/assets/javascripts/gridx/nls/it/Body.js +11 -0
  311. data/app/assets/javascripts/gridx/nls/it/FilterBar.js +89 -0
  312. data/app/assets/javascripts/gridx/nls/it/NestedSort.js +11 -0
  313. data/app/assets/javascripts/gridx/nls/it/PaginationBar.js +34 -0
  314. data/app/assets/javascripts/gridx/nls/it/QuickFilter.js +7 -0
  315. data/app/assets/javascripts/gridx/nls/it/SummaryBar.js +5 -0
  316. data/app/assets/javascripts/gridx/nls/ja/Body.js +11 -0
  317. data/app/assets/javascripts/gridx/nls/ja/FilterBar.js +89 -0
  318. data/app/assets/javascripts/gridx/nls/ja/NestedSort.js +11 -0
  319. data/app/assets/javascripts/gridx/nls/ja/PaginationBar.js +34 -0
  320. data/app/assets/javascripts/gridx/nls/ja/QuickFilter.js +7 -0
  321. data/app/assets/javascripts/gridx/nls/ja/SummaryBar.js +5 -0
  322. data/app/assets/javascripts/gridx/nls/kk/Body.js +11 -0
  323. data/app/assets/javascripts/gridx/nls/kk/FilterBar.js +89 -0
  324. data/app/assets/javascripts/gridx/nls/kk/NestedSort.js +13 -0
  325. data/app/assets/javascripts/gridx/nls/kk/PaginationBar.js +30 -0
  326. data/app/assets/javascripts/gridx/nls/kk/QuickFilter.js +9 -0
  327. data/app/assets/javascripts/gridx/nls/kk/SummaryBar.js +7 -0
  328. data/app/assets/javascripts/gridx/nls/ko/Body.js +11 -0
  329. data/app/assets/javascripts/gridx/nls/ko/FilterBar.js +89 -0
  330. data/app/assets/javascripts/gridx/nls/ko/NestedSort.js +11 -0
  331. data/app/assets/javascripts/gridx/nls/ko/PaginationBar.js +34 -0
  332. data/app/assets/javascripts/gridx/nls/ko/QuickFilter.js +7 -0
  333. data/app/assets/javascripts/gridx/nls/ko/SummaryBar.js +5 -0
  334. data/app/assets/javascripts/gridx/nls/nb/Body.js +11 -0
  335. data/app/assets/javascripts/gridx/nls/nb/FilterBar.js +89 -0
  336. data/app/assets/javascripts/gridx/nls/nb/NestedSort.js +11 -0
  337. data/app/assets/javascripts/gridx/nls/nb/PaginationBar.js +34 -0
  338. data/app/assets/javascripts/gridx/nls/nb/QuickFilter.js +7 -0
  339. data/app/assets/javascripts/gridx/nls/nb/SummaryBar.js +5 -0
  340. data/app/assets/javascripts/gridx/nls/nl/Body.js +11 -0
  341. data/app/assets/javascripts/gridx/nls/nl/FilterBar.js +89 -0
  342. data/app/assets/javascripts/gridx/nls/nl/NestedSort.js +11 -0
  343. data/app/assets/javascripts/gridx/nls/nl/PaginationBar.js +34 -0
  344. data/app/assets/javascripts/gridx/nls/nl/QuickFilter.js +7 -0
  345. data/app/assets/javascripts/gridx/nls/nl/SummaryBar.js +5 -0
  346. data/app/assets/javascripts/gridx/nls/pl/Body.js +11 -0
  347. data/app/assets/javascripts/gridx/nls/pl/FilterBar.js +89 -0
  348. data/app/assets/javascripts/gridx/nls/pl/NestedSort.js +11 -0
  349. data/app/assets/javascripts/gridx/nls/pl/PaginationBar.js +34 -0
  350. data/app/assets/javascripts/gridx/nls/pl/QuickFilter.js +7 -0
  351. data/app/assets/javascripts/gridx/nls/pl/SummaryBar.js +5 -0
  352. data/app/assets/javascripts/gridx/nls/pt/Body.js +11 -0
  353. data/app/assets/javascripts/gridx/nls/pt/FilterBar.js +89 -0
  354. data/app/assets/javascripts/gridx/nls/pt/NestedSort.js +13 -0
  355. data/app/assets/javascripts/gridx/nls/pt/PaginationBar.js +30 -0
  356. data/app/assets/javascripts/gridx/nls/pt/QuickFilter.js +9 -0
  357. data/app/assets/javascripts/gridx/nls/pt/SummaryBar.js +7 -0
  358. data/app/assets/javascripts/gridx/nls/pt-br/Body.js +6 -0
  359. data/app/assets/javascripts/gridx/nls/pt-br/FilterBar.js +89 -0
  360. data/app/assets/javascripts/gridx/nls/pt-br/NestedSort.js +11 -0
  361. data/app/assets/javascripts/gridx/nls/pt-br/PaginationBar.js +34 -0
  362. data/app/assets/javascripts/gridx/nls/pt-br/QuickFilter.js +7 -0
  363. data/app/assets/javascripts/gridx/nls/pt-br/SummaryBar.js +5 -0
  364. data/app/assets/javascripts/gridx/nls/pt-pt/Body.js +11 -0
  365. data/app/assets/javascripts/gridx/nls/pt-pt/FilterBar.js +89 -0
  366. data/app/assets/javascripts/gridx/nls/pt-pt/NestedSort.js +13 -0
  367. data/app/assets/javascripts/gridx/nls/pt-pt/PaginationBar.js +30 -0
  368. data/app/assets/javascripts/gridx/nls/pt-pt/QuickFilter.js +9 -0
  369. data/app/assets/javascripts/gridx/nls/pt-pt/SummaryBar.js +7 -0
  370. data/app/assets/javascripts/gridx/nls/ro/Body.js +11 -0
  371. data/app/assets/javascripts/gridx/nls/ro/FilterBar.js +89 -0
  372. data/app/assets/javascripts/gridx/nls/ro/NestedSort.js +13 -0
  373. data/app/assets/javascripts/gridx/nls/ro/PaginationBar.js +30 -0
  374. data/app/assets/javascripts/gridx/nls/ro/QuickFilter.js +9 -0
  375. data/app/assets/javascripts/gridx/nls/ro/SummaryBar.js +7 -0
  376. data/app/assets/javascripts/gridx/nls/ru/Body.js +11 -0
  377. data/app/assets/javascripts/gridx/nls/ru/FilterBar.js +89 -0
  378. data/app/assets/javascripts/gridx/nls/ru/NestedSort.js +11 -0
  379. data/app/assets/javascripts/gridx/nls/ru/PaginationBar.js +34 -0
  380. data/app/assets/javascripts/gridx/nls/ru/QuickFilter.js +7 -0
  381. data/app/assets/javascripts/gridx/nls/ru/SummaryBar.js +5 -0
  382. data/app/assets/javascripts/gridx/nls/sk/Body.js +11 -0
  383. data/app/assets/javascripts/gridx/nls/sk/FilterBar.js +89 -0
  384. data/app/assets/javascripts/gridx/nls/sk/NestedSort.js +13 -0
  385. data/app/assets/javascripts/gridx/nls/sk/PaginationBar.js +30 -0
  386. data/app/assets/javascripts/gridx/nls/sk/QuickFilter.js +9 -0
  387. data/app/assets/javascripts/gridx/nls/sk/SummaryBar.js +7 -0
  388. data/app/assets/javascripts/gridx/nls/sl/Body.js +11 -0
  389. data/app/assets/javascripts/gridx/nls/sl/FilterBar.js +89 -0
  390. data/app/assets/javascripts/gridx/nls/sl/NestedSort.js +11 -0
  391. data/app/assets/javascripts/gridx/nls/sl/PaginationBar.js +34 -0
  392. data/app/assets/javascripts/gridx/nls/sl/QuickFilter.js +7 -0
  393. data/app/assets/javascripts/gridx/nls/sl/SummaryBar.js +5 -0
  394. data/app/assets/javascripts/gridx/nls/sv/Body.js +11 -0
  395. data/app/assets/javascripts/gridx/nls/sv/FilterBar.js +89 -0
  396. data/app/assets/javascripts/gridx/nls/sv/NestedSort.js +11 -0
  397. data/app/assets/javascripts/gridx/nls/sv/PaginationBar.js +34 -0
  398. data/app/assets/javascripts/gridx/nls/sv/QuickFilter.js +7 -0
  399. data/app/assets/javascripts/gridx/nls/sv/SummaryBar.js +5 -0
  400. data/app/assets/javascripts/gridx/nls/th/Body.js +11 -0
  401. data/app/assets/javascripts/gridx/nls/th/FilterBar.js +89 -0
  402. data/app/assets/javascripts/gridx/nls/th/NestedSort.js +11 -0
  403. data/app/assets/javascripts/gridx/nls/th/PaginationBar.js +34 -0
  404. data/app/assets/javascripts/gridx/nls/th/QuickFilter.js +7 -0
  405. data/app/assets/javascripts/gridx/nls/th/SummaryBar.js +5 -0
  406. data/app/assets/javascripts/gridx/nls/tr/Body.js +11 -0
  407. data/app/assets/javascripts/gridx/nls/tr/FilterBar.js +89 -0
  408. data/app/assets/javascripts/gridx/nls/tr/NestedSort.js +11 -0
  409. data/app/assets/javascripts/gridx/nls/tr/PaginationBar.js +34 -0
  410. data/app/assets/javascripts/gridx/nls/tr/QuickFilter.js +7 -0
  411. data/app/assets/javascripts/gridx/nls/tr/SummaryBar.js +5 -0
  412. data/app/assets/javascripts/gridx/nls/uk/Body.js +11 -0
  413. data/app/assets/javascripts/gridx/nls/uk/FilterBar.js +88 -0
  414. data/app/assets/javascripts/gridx/nls/uk/NestedSort.js +12 -0
  415. data/app/assets/javascripts/gridx/nls/uk/PaginationBar.js +28 -0
  416. data/app/assets/javascripts/gridx/nls/uk/QuickFilter.js +8 -0
  417. data/app/assets/javascripts/gridx/nls/uk/SummaryBar.js +6 -0
  418. data/app/assets/javascripts/gridx/nls/zh/Body.js +11 -0
  419. data/app/assets/javascripts/gridx/nls/zh/FilterBar.js +89 -0
  420. data/app/assets/javascripts/gridx/nls/zh/NestedSort.js +11 -0
  421. data/app/assets/javascripts/gridx/nls/zh/PaginationBar.js +34 -0
  422. data/app/assets/javascripts/gridx/nls/zh/QuickFilter.js +7 -0
  423. data/app/assets/javascripts/gridx/nls/zh/SummaryBar.js +5 -0
  424. data/app/assets/javascripts/gridx/nls/zh-tw/Body.js +11 -0
  425. data/app/assets/javascripts/gridx/nls/zh-tw/FilterBar.js +89 -0
  426. data/app/assets/javascripts/gridx/nls/zh-tw/NestedSort.js +11 -0
  427. data/app/assets/javascripts/gridx/nls/zh-tw/PaginationBar.js +34 -0
  428. data/app/assets/javascripts/gridx/nls/zh-tw/QuickFilter.js +7 -0
  429. data/app/assets/javascripts/gridx/nls/zh-tw/SummaryBar.js +5 -0
  430. data/app/assets/javascripts/gridx/support/DropDownPager.js +111 -0
  431. data/app/assets/javascripts/gridx/support/DropDownSizer.js +112 -0
  432. data/app/assets/javascripts/gridx/support/GotoPageButton.js +92 -0
  433. data/app/assets/javascripts/gridx/support/GotoPagePane.js +61 -0
  434. data/app/assets/javascripts/gridx/support/LinkPager.js +180 -0
  435. data/app/assets/javascripts/gridx/support/LinkSizer.js +138 -0
  436. data/app/assets/javascripts/gridx/support/QuickFilter.js +138 -0
  437. data/app/assets/javascripts/gridx/support/Summary.js +49 -0
  438. data/app/assets/javascripts/gridx/support/_LinkPageBase.js +92 -0
  439. data/app/assets/javascripts/gridx/support/exporter/exporter.js +350 -0
  440. data/app/assets/javascripts/gridx/support/exporter/toCSV.js +75 -0
  441. data/app/assets/javascripts/gridx/support/exporter/toTable.js +92 -0
  442. data/app/assets/javascripts/gridx/support/menu/AZFilterMenu.js +57 -0
  443. data/app/assets/javascripts/gridx/support/menu/NumberFilterMenu.js +87 -0
  444. data/app/assets/javascripts/gridx/support/menu/_FilterMenuBase.js +83 -0
  445. data/app/assets/javascripts/gridx/support/printer.js +157 -0
  446. data/app/assets/javascripts/gridx/templates/FilterBar.html +8 -0
  447. data/app/assets/javascripts/gridx/templates/FilterConfirmDialog.html +5 -0
  448. data/app/assets/javascripts/gridx/templates/FilterDialog.html +19 -0
  449. data/app/assets/javascripts/gridx/templates/FilterPane.html +64 -0
  450. data/app/assets/javascripts/gridx/templates/GotoPagePane.html +28 -0
  451. data/app/assets/javascripts/gridx/templates/Grid.html +19 -0
  452. data/app/assets/javascripts/gridx/templates/LinkPager.html +24 -0
  453. data/app/assets/javascripts/gridx/templates/PaginationBar.html +60 -0
  454. data/app/assets/javascripts/gridx/templates/PaginationBarDD.html +23 -0
  455. data/app/assets/javascripts/gridx/templates/QuickFilter.html +38 -0
  456. data/app/assets/stylesheets/gridx/mobile/themes/iphone/Grid.css +107 -0
  457. data/app/assets/stylesheets/gridx/resources/Dod.css +39 -0
  458. data/app/assets/stylesheets/gridx/resources/Gridx.css +10 -0
  459. data/app/assets/stylesheets/gridx/resources/Gridx_rtl.css +5 -0
  460. data/app/assets/stylesheets/gridx/resources/Tree.css +46 -0
  461. data/app/assets/stylesheets/gridx/resources/Tree_rtl.css +4 -0
  462. data/app/assets/stylesheets/gridx/resources/bar.css +24 -0
  463. data/app/assets/stylesheets/gridx/resources/basic.css +482 -0
  464. data/app/assets/stylesheets/gridx/resources/basic_rtl.css +37 -0
  465. data/app/assets/stylesheets/gridx/resources/claro/Gridx.css +16 -0
  466. data/app/assets/stylesheets/gridx/resources/claro/Gridx_rtl.css +7 -0
  467. data/app/assets/stylesheets/gridx/resources/claro/basic.css +109 -0
  468. data/app/assets/stylesheets/gridx/resources/claro/basic_rtl.css +21 -0
  469. data/app/assets/stylesheets/gridx/resources/claro/filter.css +47 -0
  470. data/app/assets/stylesheets/gridx/resources/claro/lock.css +19 -0
  471. data/app/assets/stylesheets/gridx/resources/claro/pagination.css +33 -0
  472. data/app/assets/stylesheets/gridx/resources/claro/select.css +20 -0
  473. data/app/assets/stylesheets/gridx/resources/dnd.css +108 -0
  474. data/app/assets/stylesheets/gridx/resources/filter.css +321 -0
  475. data/app/assets/stylesheets/gridx/resources/filter_rtl.css +38 -0
  476. data/app/assets/stylesheets/gridx/resources/lock.css +20 -0
  477. data/app/assets/stylesheets/gridx/resources/pagination.css +142 -0
  478. data/app/assets/stylesheets/gridx/resources/pagination_rtl.css +54 -0
  479. data/app/assets/stylesheets/gridx/resources/select.css +39 -0
  480. data/app/assets/stylesheets/gridx/resources/sort.css +154 -0
  481. data/app/assets/stylesheets/gridx/resources/sort_rtl.css +51 -0
  482. data/lib/gridx-rails/engine.rb +8 -0
  483. data/lib/gridx-rails/version.rb +3 -0
  484. data/lib/gridx-rails.rb +4 -0
  485. data/lib/tasks/gridx-rails_tasks.rake +52 -0
  486. data/test/dummy/README.rdoc +261 -0
  487. data/test/dummy/Rakefile +7 -0
  488. data/test/dummy/app/assets/javascripts/application.js +15 -0
  489. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  490. data/test/dummy/app/controllers/application_controller.rb +3 -0
  491. data/test/dummy/app/helpers/application_helper.rb +2 -0
  492. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  493. data/test/dummy/config/application.rb +59 -0
  494. data/test/dummy/config/boot.rb +10 -0
  495. data/test/dummy/config/database.yml +25 -0
  496. data/test/dummy/config/environment.rb +5 -0
  497. data/test/dummy/config/environments/development.rb +37 -0
  498. data/test/dummy/config/environments/production.rb +67 -0
  499. data/test/dummy/config/environments/test.rb +37 -0
  500. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  501. data/test/dummy/config/initializers/inflections.rb +15 -0
  502. data/test/dummy/config/initializers/mime_types.rb +5 -0
  503. data/test/dummy/config/initializers/secret_token.rb +7 -0
  504. data/test/dummy/config/initializers/session_store.rb +8 -0
  505. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  506. data/test/dummy/config/locales/en.yml +5 -0
  507. data/test/dummy/config/routes.rb +58 -0
  508. data/test/dummy/config.ru +4 -0
  509. data/test/dummy/db/test.sqlite3 +0 -0
  510. data/test/dummy/log/test.log +78 -0
  511. data/test/dummy/public/404.html +26 -0
  512. data/test/dummy/public/422.html +26 -0
  513. data/test/dummy/public/500.html +25 -0
  514. data/test/dummy/public/favicon.ico +0 -0
  515. data/test/dummy/script/rails +6 -0
  516. data/test/gridx-rails_test.rb +7 -0
  517. data/test/test_helper.rb +15 -0
  518. metadata +621 -0
@@ -0,0 +1,1059 @@
1
+ define([
2
+ /*====="../core/Row",=====*/
3
+ /*====="../core/Cell",=====*/
4
+ "dojo/_base/declare",
5
+ "dojo/query",
6
+ "dojo/_base/array",
7
+ "dojo/_base/lang",
8
+ "dojo/_base/json",
9
+ "dojo/dom-construct",
10
+ "dojo/dom-class",
11
+ "dojo/_base/Deferred",
12
+ "dojo/_base/sniff",
13
+ "dojo/keys",
14
+ "../core/_Module",
15
+ "dojo/i18n",
16
+ "dojo/i18n!../nls/Body"
17
+ // "dojo/NodeList-dom",
18
+ // "dojo/NodeList-traverse"
19
+ ], function(/*=====Row, Cell, =====*/declare, query, array, lang, json, domConstruct, domClass, Deferred, has, keys, _Module, i18n){
20
+
21
+ /*=====
22
+ Row.node = function(){
23
+ // summary:
24
+ // Get the dom node of this row.
25
+ // returns:
26
+ // DOMNode|null
27
+ };
28
+
29
+ Cell.node = function(){
30
+ // summary:
31
+ // Get the dom node of this cell.
32
+ // returns:
33
+ // DOMNode|null
34
+ };
35
+
36
+ Cell.contentNode = function(){
37
+ // summary:
38
+ // Get the dom node in this cell that actually contains data.
39
+ // This function is useful if some modules (e.g. Tree) wraps cell data with some extra html.
40
+ // returns:
41
+ // DOMNode|null
42
+ };
43
+
44
+ var Body = declare(_Module, {
45
+ // summary:
46
+ // The body UI of grid.
47
+ // description:
48
+ // This module is in charge of row rendering. It should be compatible with virtual/non-virtual scroll,
49
+ // pagination, details on demand, and even tree structure.
50
+
51
+ // loadingInfo: String
52
+ // The loading message shown in grid body. Default to use nls files.
53
+ loadingInfo: '',
54
+
55
+ // emptyInfo: String
56
+ // The message shown in grid body when there's no row to show. Default to use nls files.
57
+ emptyInfo: '',
58
+
59
+ // loadFailInfo: String
60
+ // The error message shown in grid body when there's some error orrured during loading. Default to use nls files.
61
+ loadFailInfo: '',
62
+
63
+ // rowHoverEffect: Boolean
64
+ // Whether to show a visual effect when mouse hovering a row.
65
+ rowHoverEffect: true,
66
+
67
+ // stuffEmptyCell: Boolean
68
+ // Whether to stuff a cell with   if it is empty.
69
+ stuffEmptyCell: true,
70
+
71
+ // renderWholeRowOnSet: Boolean
72
+ // If true, the whole row will be re-rendered even if only one field has changed.
73
+ // Default to false, so that only one cell will be re-rendered editing that cell.
74
+ renderWholeRowOnSet: false,
75
+
76
+ // compareOnSet: Function
77
+ // When data is changed in store, compare the old data and the new data of grid, return true if
78
+ // they are the same, false if not, so that the body can decide whether to refresh the corresponding cell.
79
+ compareOnSet: function(v1, v2){},
80
+
81
+ getRowNode: function(args){
82
+ // summary:
83
+ // Get the DOM node of a row
84
+ // args: View.__RowInfo
85
+ // A row info object containing row index or row id
86
+ // returns:
87
+ // The DOM node of the row. Null if not found.
88
+ },
89
+
90
+ getCellNode: function(args){
91
+ // summary:
92
+ // Get the DOM node of a cell
93
+ // args: View.__CellInfo
94
+ // A cell info object containing sufficient info
95
+ // returns:
96
+ // The DOM node of the cell. Null if not found.
97
+ },
98
+
99
+ refresh: function(start){
100
+ // summary:
101
+ // Refresh the grid body
102
+ // start: Integer?
103
+ // The visual row index to start refresh. If omitted, default to 0.
104
+ // returns:
105
+ // A deferred object indicating when the refreshing process is finished.
106
+ },
107
+
108
+ refreshCell: function(rowVisualIndex, columnIndex){
109
+ // summary:
110
+ // Refresh a single cell
111
+ // rowVisualIndex: Integer
112
+ // The visual index of the row of this cell
113
+ // columnIndex: Integer
114
+ // The index of the column of this cell
115
+ // returns:
116
+ // A deferred object indicating when this refreshing process is finished.
117
+ },
118
+
119
+ // renderStart: [readonly] Integer
120
+ // The visual row index of the first renderred row in the current body
121
+ renderStart: 0,
122
+
123
+ // renderCount: [readonly] Integer
124
+ // The count of renderred rows in the current body.
125
+ renderCount: 0,
126
+
127
+ // autoUpdate: [private] Boolean
128
+ // Update grid body automatically when onNew/onSet/onDelete is fired
129
+ autoUpdate: true,
130
+
131
+ onAfterRow: function(row){
132
+ // summary:
133
+ // Fired when a row is created, data is filled in, and its node is inserted into the dom tree.
134
+ // row: gridx.core.Row
135
+ // A row object representing this row.
136
+ },
137
+
138
+ onAfterCell: function(cell){
139
+ // summary:
140
+ // Fired when a cell is updated by cell editor (or store data change), or by cell refreshing.
141
+ // Note this is not fired when rendering the whole grid. Use onAfterRow in that case.
142
+ // cell: grid.core.Cell
143
+ // A cell object representing this cell
144
+ },
145
+
146
+ onRender: function(start, count){
147
+ // summary:
148
+ // Fired everytime the grid body content is rendered or updated.
149
+ // start: Integer
150
+ // The visual index of the start row that is affected by this rendering. If omitted, all rows are affected.
151
+ // count: Integer
152
+ // The count of rows that is affected by this rendering. If omitted, all rows from start are affected.
153
+ },
154
+
155
+ onUnrender: function(){
156
+ // summary:
157
+ // Fired when a row is unrendered (removed from the grid dom tree).
158
+ // Usually, this event is only useful when using virtual scrolling.
159
+ // id: String|Number
160
+ // The ID of the row that is unrendered.
161
+ },
162
+
163
+ onDelete: function(){
164
+ // summary:
165
+ // Fired when a row in current view is deleted from the store.
166
+ // Note if the deleted row is not visible in current view, this event will not fire.
167
+ // id: String|Number
168
+ // The ID of the deleted row.
169
+ // index: Integer
170
+ // The index of the deleted row.
171
+ },
172
+
173
+ onSet: function(row){
174
+ // summary:
175
+ // Fired when a row in current view is updated in store.
176
+ // row: gridx.core.Row
177
+ // A row object representing the updated row.
178
+ },
179
+
180
+ onMoveToCell: function(){
181
+ // summary:
182
+ // Fired when the focus is moved to a body cell by keyboard.
183
+ // tags:
184
+ // private
185
+ },
186
+
187
+ onEmpty: function(){
188
+ // summary:
189
+ // Fired when there's no rows in current body view.
190
+ },
191
+
192
+ onLoadFail: function(){
193
+ // summary:
194
+ // Fire when there's an error occured when loading data.
195
+ },
196
+
197
+ onForcedScroll: function(){
198
+ // summary:
199
+ // Fired when the body needs to fetch more data, but there's no trigger to the scroller.
200
+ // This is an inner mechanism to solve some problems when using virtual scrolling or pagination.
201
+ // This event should not be used by grid users.
202
+ // tags:
203
+ // private
204
+ },
205
+
206
+ collectCellWrapper: function(){
207
+ // summary:
208
+ // Fired when a cell is being rendered, so as to collect wrappers for the content in this cell.
209
+ // This is currently an inner mechanism used to implement widgets in cell and tree node.
210
+ // tags:
211
+ // private
212
+ // wrappers: Array
213
+ // An array of functions with signature function(cellData, rowId, colId) and should return a string to replace
214
+ // cell data. The connectors of this event should push a new wrapper function in this array.
215
+ // The functions in this array can also carry a number typed "priority" property.
216
+ // The wrappers will be executed in ascending order of this "priority" function.
217
+ // rowId: String|Number
218
+ // The row ID of this cell
219
+ // colId: String|Number
220
+ // The column ID of this cell.
221
+ }
222
+ });
223
+
224
+ return Body;
225
+ =====*/
226
+
227
+ return declare(_Module, {
228
+ name: "body",
229
+
230
+ forced: ['view'],
231
+
232
+ constructor: function(){
233
+ var t = this,
234
+ g = t.grid,
235
+ dn = t.domNode = g.bodyNode;
236
+ t._cellCls = {};
237
+ t._nls = i18n.getLocalization('gridx', 'Body', g.lang);
238
+ if(t.arg('rowHoverEffect')){
239
+ domClass.add(dn, 'gridxBodyRowHoverEffect');
240
+ }
241
+ g.emptyNode.innerHTML = t.arg('loadingInfo', t._nls.loadingInfo);
242
+ g._connectEvents(dn, '_onMouseEvent', t);
243
+ t.aspect(t.model, 'onSet', '_onSet');
244
+ t.aspect(g, 'onRowMouseOver', '_onRowMouseOver');
245
+ t.connect(g.mainNode, 'onmouseleave', function(){
246
+ query('> .gridxRowOver', t.domNode).removeClass('gridxRowOver');
247
+ });
248
+ t.connect(g.mainNode, 'onmouseover', function(e){
249
+ if(e.target == g.bodyNode){
250
+ query('> .gridxRowOver', t.domNode).removeClass('gridxRowOver');
251
+ }
252
+ });
253
+ t.aspect(g, 'setStore', function(){
254
+ t.refresh();
255
+ });
256
+ },
257
+
258
+ preload: function(){
259
+ this._initFocus();
260
+ },
261
+
262
+ load: function(args){
263
+ var t = this,
264
+ view = t.grid.view;
265
+ t.aspect(view, 'onUpdate', 'lazyRefresh');
266
+ if(view._err){
267
+ t._loadFail(view._err);
268
+ }
269
+ t.loaded.callback();
270
+ },
271
+
272
+ destroy: function(){
273
+ this.inherited(arguments);
274
+ this.domNode.innerHTML = '';
275
+ this._destroyed = true;
276
+ },
277
+
278
+ rowMixin: {
279
+ node: function(){
280
+ return this.grid.body.getRowNode({
281
+ rowId: this.id
282
+ });
283
+ }
284
+ },
285
+
286
+ cellMixin: {
287
+ node: function(){
288
+ return this.grid.body.getCellNode({
289
+ rowId: this.row.id,
290
+ colId: this.column.id
291
+ });
292
+ },
293
+ contentNode: function(){
294
+ var node = this.node();
295
+ return node && query('.gridxCellContent', node)[0] || node;
296
+ }
297
+ },
298
+
299
+ rowHoverEffect: true,
300
+
301
+ stuffEmptyCell: true,
302
+
303
+ renderWholeRowOnSet: false,
304
+
305
+ renderStart: 0,
306
+
307
+ renderCount: 0,
308
+
309
+ autoUpdate: true,
310
+
311
+ compareOnSet: function(v1, v2){
312
+ return typeof v1 == 'object' && typeof v2 == 'object' ?
313
+ json.toJson(v1) == json.toJson(v2) :
314
+ v1 === v2;
315
+ },
316
+
317
+ addClass: function(rowId, colId, cls){
318
+ var cellCls = this._cellCls,
319
+ r = cellCls[rowId] = cellCls[rowId] || {},
320
+ c = r[colId] = r[colId] || [];
321
+ if(array.indexOf(c, cls) < 0){
322
+ c.push(cls);
323
+ domClass.add(this.getCellNode({
324
+ rowId: rowId,
325
+ colId: colId
326
+ }), cls);
327
+ }
328
+ },
329
+
330
+ removeClass: function(rowId, colId, cls){
331
+ var cellCls = this._cellCls,
332
+ r = cellCls[rowId],
333
+ c = r && r[colId],
334
+ idx = c && array.indexOf(c, cls);
335
+ if(idx >= 0){
336
+ c.splice(idx, 1);
337
+ domClass.remove(this.getCellNode({
338
+ rowId: rowId,
339
+ colId: colId
340
+ }), cls);
341
+ }
342
+ },
343
+
344
+ getRowNode: function(args){
345
+ if(this.model.isId(args.rowId) && has('ie')){
346
+ return this._getRowNode(args.rowId);
347
+ }else{
348
+ var rowQuery = this._getRowNodeQuery(args);
349
+ return rowQuery && query('> ' + rowQuery, this.domNode)[0] || null; //DOMNode|null
350
+ }
351
+ },
352
+
353
+ getCellNode: function(args){
354
+ var t = this,
355
+ colId = args.colId,
356
+ cols = t.grid._columns,
357
+ r = t._getRowNodeQuery(args);
358
+ if(r){
359
+ if(!colId && cols[args.colIndex]){
360
+ colId = cols[args.colIndex].id;
361
+ }
362
+ var c = " [colid='" + colId + "'].gridxCell";
363
+ if(t.model.isId(args.rowId) && has('ie')){
364
+ var rowNode = t._getRowNode(args.rowId);
365
+ return rowNode && query(c, rowNode)[0] || null;
366
+ }else{
367
+ return query(r + c, t.domNode)[0] || null;
368
+ }
369
+ }
370
+ return null;
371
+ },
372
+
373
+ refresh: function(start){
374
+ var t = this,
375
+ loadingNode = t.grid.loadingNode,
376
+ d = new Deferred();
377
+ delete t._err;
378
+ domClass.add(loadingNode, 'gridxLoading');
379
+ domClass.toggle(t.domNode, 'gridxBodyRowHoverEffect', t.arg('rowHoverEffect'));
380
+
381
+ t.grid.view.updateVisualCount().then(function(){
382
+ try{
383
+ var rs = t.renderStart,
384
+ rc = t.renderCount,
385
+ vc = t.grid.view.visualCount;
386
+ if(rs + rc > vc){
387
+ if(rc < vc){
388
+ rs = t.renderStart = vc - rc;
389
+ }else{
390
+ rs = t.renderStart = 0;
391
+ rc = vc;
392
+ }
393
+ }
394
+ if(typeof start == 'number' && start >= 0){
395
+ start = rs > start ? rs : start;
396
+ var count = rs + rc - start,
397
+ n = query('> [visualindex="' + start + '"]', t.domNode)[0],
398
+ uncachedRows = [],
399
+ renderedRows = [];
400
+ if(n){
401
+ var rows = t._buildRows(start, count, uncachedRows, renderedRows);
402
+ if(rows){
403
+ domConstruct.place(rows, n, 'before');
404
+ }
405
+ }
406
+ var rowIds = {};
407
+ array.forEach(renderedRows, function(row){
408
+ rowIds[row.id] = 1;
409
+ });
410
+ while(n){
411
+ var tmp = n.nextSibling,
412
+ id = n.getAttribute('rowid');
413
+ if(!rowIds[id]){
414
+ //Unrender this row only when it is not being rendered now.
415
+ //Set a special flag so that RowHeader won't destroy its nodes.
416
+ //FIXME: this is ugly...
417
+ t.onUnrender(id, 'refresh');
418
+ }
419
+ domConstruct.destroy(n);
420
+ n = tmp;
421
+ }
422
+ array.forEach(renderedRows, t.onAfterRow, t);
423
+ Deferred.when(t._buildUncachedRows(uncachedRows), function(){
424
+ t.onRender(start, count);
425
+ t.onForcedScroll();
426
+ domClass.remove(loadingNode, 'gridxLoading');
427
+ d.callback();
428
+ });
429
+ }else{
430
+ t.renderRows(rs, rc, 0, 1);
431
+ t.onForcedScroll();
432
+ domClass.remove(loadingNode, 'gridxLoading');
433
+ d.callback();
434
+ }
435
+ }catch(e){
436
+ t._loadFail(e);
437
+ domClass.remove(loadingNode, 'gridxLoading');
438
+ d.errback(e);
439
+ }
440
+ }, function(e){
441
+ t._loadFail(e);
442
+ domClass.remove(loadingNode, 'gridxLoading');
443
+ d.errback(e);
444
+ });
445
+ return d;
446
+ },
447
+
448
+ refreshCell: function(rowVisualIndex, columnIndex){
449
+ var d = new Deferred(),
450
+ t = this,
451
+ m = t.model,
452
+ g = t.grid,
453
+ col = g._columns[columnIndex],
454
+ cellNode = col && t.getCellNode({
455
+ visualIndex: rowVisualIndex,
456
+ colId: col.id
457
+ });
458
+ if(cellNode){
459
+ var rowCache,
460
+ rowInfo = g.view.getRowInfo({visualIndex: rowVisualIndex}),
461
+ idx = rowInfo.rowIndex,
462
+ pid = rowInfo.parentId;
463
+ m.when({
464
+ start: idx,
465
+ count: 1,
466
+ parentId: pid
467
+ }, function(){
468
+ rowCache = m.byIndex(idx, pid);
469
+ if(rowCache){
470
+ rowInfo.rowId = m.indexToId(idx, pid);
471
+ var cell = g.cell(rowInfo.rowId, col.id, 1),
472
+ isPadding = g.tree && g.tree.isPaddingCell(rowInfo.rowId, col.id);
473
+ cellNode.innerHTML = t._buildCellContent(col, rowInfo.rowId, cell, rowVisualIndex, isPadding);
474
+ t.onAfterCell(cell);
475
+ }
476
+ }).then(function(){
477
+ d.callback(!!rowCache);
478
+ });
479
+ return d;
480
+ }
481
+ d.callback(false);
482
+ return d;
483
+ },
484
+
485
+ lazyRefresh: function(){
486
+ var t = this;
487
+ clearTimeout(t._sizeChangeHandler);
488
+ t._sizeChangeHandler = setTimeout(function(){
489
+ if(!t._destroyed){
490
+ t.refresh();
491
+ }
492
+ }, 10);
493
+ },
494
+
495
+ renderRows: function(start, count, position/*?top|bottom*/, isRefresh){
496
+ var t = this,
497
+ g = t.grid,
498
+ str = '',
499
+ uncachedRows = [],
500
+ renderedRows = [],
501
+ n = t.domNode,
502
+ en = g.emptyNode,
503
+ emptyInfo = t.arg('emptyInfo', t._nls.emptyInfo),
504
+ finalInfo = '';
505
+ if(t._err){
506
+ return;
507
+ }
508
+ if(count > 0){
509
+ en.innerHTML = t.arg('loadingInfo', t._nls.loadingInfo);
510
+ en.style.zIndex = '';
511
+ if(position != 'top' && position != 'bottom'){
512
+ t.model.free();
513
+ }
514
+ str = t._buildRows(start, count, uncachedRows, renderedRows);
515
+ if(position == 'top'){
516
+ t.renderCount += t.renderStart - start;
517
+ t.renderStart = start;
518
+ domConstruct.place(str, n, 'first');
519
+ //unrender out-of-range rows immediately, so that CellWidget can reuse the widgets.
520
+ //FIXME: need a better solution here!
521
+ if(g.cellWidget && g.vScroller._updateRowHeight){
522
+ var oldEnd = t.renderStart + t.renderCount,
523
+ postCount = g.vScroller._updateRowHeight('post');
524
+ if(oldEnd - postCount < start + count){
525
+ count = oldEnd - postCount - start;
526
+ }
527
+ }
528
+ }else if(position == 'bottom'){
529
+ t.renderCount = start + count - t.renderStart;
530
+ domConstruct.place(str, n, 'last');
531
+ //unrender out-of-range rows immediately, so that CellWidget can reuse the widgets.
532
+ //FIXME: need a better solution here!
533
+ if(g.cellWidget && g.vScroller._updateRowHeight){
534
+ g.vScroller._updateRowHeight('pre');
535
+ if(t.renderStart > start){
536
+ start = t.renderStart;
537
+ count = t.renderCount;
538
+ }
539
+ }
540
+ }else{
541
+ t.renderStart = start;
542
+ t.renderCount = count;
543
+ //If is refresh, try to maintain the scroll top
544
+ var scrollTop = isRefresh ? n.scrollTop : 0;
545
+ n.scrollTop = 0;
546
+ //unrender before destroy nodes, so that other modules have a chance to detach nodes.
547
+ t.onUnrender();
548
+ n.innerHTML = str;
549
+ if(scrollTop){
550
+ n.scrollTop = scrollTop;
551
+ }
552
+ n.scrollLeft = g.hScrollerNode.scrollLeft;
553
+ finalInfo = str ? "" : emptyInfo;
554
+ if(!str){
555
+ en.style.zIndex = 1;
556
+ }
557
+ }
558
+ array.forEach(renderedRows, t.onAfterRow, t);
559
+ Deferred.when(t._buildUncachedRows(uncachedRows), function(){
560
+ if(!t._err){
561
+ en.innerHTML = finalInfo;
562
+ }
563
+ t.onRender(start, count);
564
+ });
565
+ }else if(!{top: 1, bottom: 1}[position]){
566
+ n.scrollTop = 0;
567
+ //unrender before destroy nodes, so that other modules have a chance to detach nodes.
568
+ t.onUnrender();
569
+ n.innerHTML = '';
570
+ en.innerHTML = emptyInfo;
571
+ en.style.zIndex = '';
572
+ t.onEmpty();
573
+ t.model.free();
574
+ }
575
+ },
576
+
577
+ unrenderRows: function(count, preOrPost){
578
+ if(count > 0){
579
+ //Just remove the nodes from DOM tree instead of destroying them,
580
+ //in case other logic still needs these nodes.
581
+ var t = this, m = t.model, i = 0, id, bn = t.domNode;
582
+ if(preOrPost == 'post'){
583
+ for(; i < count && bn.lastChild; ++i){
584
+ id = bn.lastChild.getAttribute('rowid');
585
+ m.free(id);
586
+ t.onUnrender(id);
587
+ domConstruct.destroy(bn.lastChild);
588
+ }
589
+ }else{
590
+ var tp = bn.scrollTop;
591
+ for(; i < count && bn.firstChild; ++i){
592
+ id = bn.firstChild.getAttribute('rowid');
593
+ m.free(id);
594
+ tp -= bn.firstChild.offsetHeight;
595
+ t.onUnrender(id);
596
+ domConstruct.destroy(bn.firstChild);
597
+ }
598
+ t.renderStart += i;
599
+ bn.scrollTop = tp > 0 ? tp : 0;
600
+ }
601
+ t.renderCount -= i;
602
+ //Force check cache size
603
+ m.when();
604
+ }
605
+ },
606
+
607
+ //Events--------------------------------------------------------------------------------
608
+ onAfterRow: function(){/* row */},
609
+
610
+ onAfterCell: function(){/* cell */},
611
+
612
+ onRender: function(/*start, count*/){
613
+ //FIX #8746
614
+ var bn = this.domNode;
615
+ if(has('ie') < 9 && bn.childNodes.length){
616
+ query('> gridxLastRow', bn).removeClass('gridxLastRow');
617
+ domClass.add(bn.lastChild, 'gridxLastRow');
618
+ }
619
+ },
620
+
621
+ onUnrender: function(/* id */){},
622
+
623
+ onDelete: function(/*id, index*/){},
624
+
625
+ onSet: function(/* row */){},
626
+
627
+ onMoveToCell: function(){},
628
+
629
+ onEmpty: function(){},
630
+
631
+ onLoadFail: function(){},
632
+
633
+ onForcedScroll: function(){},
634
+
635
+ collectCellWrapper: function(/* wrappers, rowId, colId */){},
636
+
637
+ //Private---------------------------------------------------------------------------
638
+ _getRowNodeQuery: function(args){
639
+ var r, m = this.model, escapeId = this.grid._escapeId;
640
+ if(m.isId(args.rowId)){
641
+ r = "[rowid='" + escapeId(args.rowId) + "']";
642
+ }else if(typeof args.rowIndex == 'number' && args.rowIndex >= 0){
643
+ r = "[rowindex='" + args.rowIndex + "']" + (m.isId(args.parentId) ? "[parentid='" + escapeId(args.parentId) + "']" : '');
644
+ }else if(typeof args.visualIndex == 'number' && args.visualIndex >= 0){
645
+ r = "[visualindex='" + args.visualIndex + "']";
646
+ }
647
+ return r && r + '.gridxRow';
648
+ },
649
+
650
+ _getRowNode: function(id){
651
+ //TODO: this should be resolved in dojo.query!
652
+ //In IE, some special ids (with special charactors in it, e.g. "+") can not be queried out.
653
+ for(var i = 0, rows = this.domNode.childNodes, row; row = rows[i]; ++i){
654
+ if(row.getAttribute('rowid') == id){
655
+ return row;
656
+ }
657
+ }
658
+ return null;
659
+ },
660
+
661
+ _loadFail: function(e){
662
+ console.error(e);
663
+ var en = this.grid.emptyNode;
664
+ en.innerHTML = this.arg('loadFailInfo', this._nls.loadFailInfo);
665
+ en.style.zIndex = 1;
666
+ this.domNode.innerHTML = '';
667
+ this._err = e;
668
+ this.onEmpty();
669
+ this.onLoadFail(e);
670
+ },
671
+
672
+ _buildRows: function(start, count, uncachedRows, renderedRows){
673
+ var t = this,
674
+ end = start + count,
675
+ s = [],
676
+ g = t.grid,
677
+ w = t.domNode.scrollWidth,
678
+ columns = g.columns(),
679
+ i = start;
680
+ for(; i < end; ++i){
681
+ var rowInfo = g.view.getRowInfo({visualIndex: i}),
682
+ row = g.row(rowInfo.rowId, 1);
683
+ s.push('<div class="gridxRow ', i % 2 ? 'gridxRowOdd' : '',
684
+ '" role="row" visualindex="', i);
685
+ if(row){
686
+ t.model.keep(row.id);
687
+ s.push('" rowid="', row.id,
688
+ '" rowindex="', rowInfo.rowIndex,
689
+ '" parentid="', rowInfo.parentId,
690
+ '">', t._buildCells(row, i, columns),
691
+ '</div>');
692
+ renderedRows.push(row);
693
+ }else{
694
+ s.push('"><div class="gridxRowDummy" style="width:', w, 'px;"></div></div>');
695
+ rowInfo.start = rowInfo.rowIndex;
696
+ rowInfo.count = 1;
697
+ uncachedRows.push(rowInfo);
698
+ }
699
+ }
700
+ return s.join('');
701
+ },
702
+
703
+ _buildUncachedRows: function(uncachedRows){
704
+ var t = this;
705
+ return uncachedRows.length && t.model.when(uncachedRows, function(){
706
+ try{
707
+ array.forEach(uncachedRows, t._buildRowContent, t);
708
+ }catch(e){
709
+ t._loadFail(e);
710
+ }
711
+ }).then(null, function(e){
712
+ t._loadFail(e);
713
+ });
714
+ },
715
+
716
+ _buildRowContent: function(rowInfo){
717
+ var t = this,
718
+ n = query('> [visualindex="' + rowInfo.visualIndex + '"]', t.domNode)[0];
719
+ if(n){
720
+ var row = t.grid.row(rowInfo.rowIndex, 0, rowInfo.parentId);
721
+ if(row){
722
+ t.model.keep(row.id);
723
+ n.setAttribute('rowid', row.id);
724
+ n.setAttribute('rowindex', rowInfo.rowIndex);
725
+ n.setAttribute('parentid', rowInfo.parentId || '');
726
+ n.innerHTML = t._buildCells(row, rowInfo.visualIndex);
727
+ t.onAfterRow(row);
728
+ }else{
729
+ console.error('Error in Body._buildRowContent: Row is not in cache: ' + rowInfo.rowIndex);
730
+ }
731
+ }
732
+ },
733
+
734
+ onCheckCustomRow: function(row, output){},
735
+
736
+ onBuildCustomRow: function(row, output){},
737
+
738
+ _buildCells: function(row, visualIndex, cols){
739
+ var t = this,
740
+ rowId = row.id,
741
+ sb = ['<table class="gridxRowTable" role="presentation" border="0" cellpadding="0" cellspacing="0"><tr>'],
742
+ output = {};
743
+ t.onCheckCustomRow(row, output);
744
+ if(output[rowId]){
745
+ output = {};
746
+ t.onBuildCustomRow(row, output);
747
+ sb.push('<td class="gridxCustomRow" aria-readonly="true" role="gridcell" tabindex="-1">',
748
+ t._wrapCellData(output[rowId], rowId),
749
+ '</td>');
750
+ }else{
751
+ var g = t.grid,
752
+ isFocusedRow = g.focus.currentArea() == 'body' && t._focusCellRow === visualIndex,
753
+ rowData = t.model.byId(rowId).data,
754
+ columns = g._columns,
755
+ cellCls = t._cellCls[rowId] || {};
756
+ for(var i = 0, len = columns.length; i < len; ++i){
757
+ var col = columns[i],
758
+ colId = col.id,
759
+ colWidth = col.width,
760
+ isPadding = g.tree && g.tree.isPaddingCell(rowId, colId),
761
+ customCls = col['class'],
762
+ cellData = rowData[colId],
763
+ customClsIsFunction = customCls && lang.isFunction(customCls),
764
+ styleIsFunction = col.style && lang.isFunction(col.style),
765
+ needCell = customClsIsFunction || styleIsFunction || (!isPadding && col.decorator),
766
+ cell = needCell && g.cell(row, cols && cols[i] || colId, 1);
767
+ sb.push('<td aria-readonly="true" role="gridcell" tabindex="-1" aria-describedby="',
768
+ col._domId,'" colid="', colId, '" class="gridxCell ',
769
+ isPadding ? 'gridxPaddingCell ' : '',
770
+ isFocusedRow && t._focusCellCol === i ? 'gridxCellFocus ' : '',
771
+ col._class || '', ' ',
772
+ (customClsIsFunction ? customCls(cell) : customCls) || '', ' ',
773
+ cellCls[colId] ? cellCls[colId].join('') : '',
774
+ ' " style="width:', colWidth, ';min-width:', colWidth, ';max-width:', colWidth, ';',
775
+ g.getTextDirStyle(colId, cellData),
776
+ (styleIsFunction ? col.style(cell) : col.style) || '',
777
+ '">', t._buildCellContent(col, rowId, cell, visualIndex, isPadding, cellData),
778
+ '</td>');
779
+ }
780
+ }
781
+ sb.push('</tr></table>');
782
+ return sb.join('');
783
+ },
784
+
785
+ _buildCellContent: function(col, rowId, cell, visualIndex, isPadding, cellData){
786
+ var r = '',
787
+ data = cellData === undefined && cell ? cell.data() : cellData;
788
+ if(!isPadding){
789
+ var s = col.decorator ? col.decorator(data, rowId, visualIndex, cell) : data;
790
+ r = this._wrapCellData(s, rowId, col.id);
791
+ }
792
+ return (r === '' || r === null || r === undefined) && (has('ie') < 8 || this.arg('stuffEmptyCell')) ? '&nbsp;' : r;
793
+ },
794
+
795
+ _wrapCellData: function(cellData, rowId, colId){
796
+ var wrappers = [];
797
+ this.collectCellWrapper(wrappers, rowId, colId);
798
+ var i = wrappers.length - 1;
799
+ if(i > 0){
800
+ wrappers.sort(function(a, b){
801
+ return (a.priority || 0) - (b.priority || 0);
802
+ });
803
+ }
804
+ for(; i >= 0; --i){
805
+ cellData = wrappers[i].wrap(cellData, rowId, colId);
806
+ }
807
+ return cellData;
808
+ },
809
+
810
+ //Events-------------------------------------------------------------
811
+ _onMouseEvent: function(eventName, e){
812
+ var g = this.grid,
813
+ evtCell = 'onCell' + eventName,
814
+ evtRow = 'onRow' + eventName;
815
+ if(g._isConnected(evtCell) || g._isConnected(evtRow)){
816
+ this._decorateEvent(e);
817
+ if(e.rowId){
818
+ if(e.columnId){
819
+ g[evtCell](e);
820
+ }
821
+ g[evtRow](e);
822
+ }
823
+ }
824
+ },
825
+
826
+ _decorateEvent: function(e){
827
+ var n = e.target || e.originalTarget,
828
+ g = this.grid,
829
+ tag;
830
+ for(; n && n != g.bodyNode; n = n.parentNode){
831
+ tag = n.tagName && n.tagName.toLowerCase();
832
+ if(tag == 'td' && domClass.contains(n, 'gridxCell')){
833
+ var col = g._columnsById[n.getAttribute('colid')];
834
+ e.cellNode = n;
835
+ e.columnId = col.id;
836
+ e.columnIndex = col.index;
837
+ }
838
+ if(tag == 'div' && domClass.contains(n, 'gridxRow')){
839
+ e.rowId = n.getAttribute('rowid');
840
+ e.parentId = n.getAttribute('parentid');
841
+ e.rowIndex = parseInt(n.getAttribute('rowindex'), 10);
842
+ e.visualIndex = parseInt(n.getAttribute('visualindex'), 10);
843
+ return;
844
+ }
845
+ }
846
+ },
847
+
848
+ //Store Notification-------------------------------------------------------------------
849
+ _onSet: function(id, index, rowCache, oldCache){
850
+ var t = this;
851
+ if(t.autoUpdate && rowCache){
852
+ var g = t.grid,
853
+ row = g.row(id, 1),
854
+ rowNode = row && row.node();
855
+ if(rowNode){
856
+ var curData = rowCache.data,
857
+ oldData = oldCache.data,
858
+ cols = g._columns,
859
+ renderWhole = t.arg('renderWholeRowOnSet'),
860
+ compareOnSet = t.arg('compareOnSet');
861
+ if(renderWhole){
862
+ rowNode.innerHTML = t._buildCells(row, row.visualIndex());
863
+ t.onAfterRow(row);
864
+ t.onSet(row);
865
+ t.onRender(index, 1);
866
+ }else{
867
+ array.forEach(cols, function(col){
868
+ if(!compareOnSet(curData[col.id], oldData[col.id])){
869
+ var isPadding = g.tree && g.tree.isPaddingCell(id, col.id),
870
+ cell = row.cell(col.id, 1);
871
+ //Support for Bidi begin
872
+ if('auto' === (col.textDir || g.textDir)){
873
+ var textDirValue = g.getTextDir(col.id, cell.node().innerHTML);
874
+ if(textDirValue){
875
+ cell.node().style.direction = textDirValue;
876
+ }
877
+ }
878
+ //Support for Bidi end
879
+ cell.node().innerHTML = t._buildCellContent(col, id, cell, row.visualIndex(), isPadding);
880
+ t.onAfterCell(cell);
881
+ }
882
+ });
883
+ }
884
+ }
885
+ }
886
+ },
887
+
888
+ //-------------------------------------------------------------------------------------
889
+ _onRowMouseOver: function(e){
890
+ var preNode = query('> div.gridxRowOver', this.domNode)[0],
891
+ rowNode = this.getRowNode({rowId: e.rowId});
892
+ if(preNode != rowNode){
893
+ if(preNode){
894
+ domClass.remove(preNode, 'gridxRowOver');
895
+ }
896
+ if(rowNode){
897
+ domClass.add(rowNode, 'gridxRowOver');
898
+ }
899
+ }
900
+ },
901
+
902
+ //Focus------------------------------------------------------------------------------------------
903
+ _focusCellCol: 0,
904
+ _focusCellRow: 0,
905
+
906
+ _initFocus: function(){
907
+ var t = this,
908
+ g = t.grid,
909
+ focus = g.focus;
910
+ focus.registerArea({
911
+ name: 'body',
912
+ priority: 1,
913
+ focusNode: t.domNode,
914
+ scope: t,
915
+ doFocus: t._doFocus,
916
+ doBlur: t._blurCell,
917
+ onFocus: t._onFocus,
918
+ onBlur: t._blurCell
919
+ });
920
+ t.connect(g.mainNode, 'onkeydown', function(evt){
921
+ if(focus.currentArea() == 'body'){
922
+ var dk = keys;
923
+ if(evt.keyCode == dk.HOME && !evt.ctrlKey){
924
+ t._focusCellCol = 0;
925
+ t._focusCell();
926
+ focus.stopEvent(evt);
927
+ }else if(evt.keyCode == dk.END && !evt.ctrlKey){
928
+ t._focusCellCol = g._columns.length - 1;
929
+ t._focusCell();
930
+ focus.stopEvent(evt);
931
+ }else if(!g.tree || !evt.ctrlKey){
932
+ focus._noBlur = 1; //1 as true
933
+ var arr = {}, dir = g.isLeftToRight() ? 1 : -1;
934
+ arr[dk.LEFT_ARROW] = [0, -dir, evt];
935
+ arr[dk.RIGHT_ARROW] = [0, dir, evt];
936
+ arr[dk.UP_ARROW] = [-1, 0, evt];
937
+ arr[dk.DOWN_ARROW] = [1, 0, evt];
938
+ t._moveFocus.apply(t, arr[evt.keyCode] || []);
939
+ focus._noBlur = 0; //0 as false
940
+ }
941
+ }
942
+ });
943
+ t.aspect(g, 'onCellClick', function(evt){
944
+ t._focusCellRow = evt.visualIndex;
945
+ t._focusCellCol = evt.columnIndex;
946
+ });
947
+ t.aspect(t, 'onRender', function(start, count){
948
+ if(t._focusCellRow >= start &&
949
+ t._focusCellRow < start + count &&
950
+ focus.currentArea() == 'body'){
951
+ t._focusCell();
952
+ }
953
+ });
954
+ t.connect(g.emptyNode, 'onfocus', function(){
955
+ focus.focusArea('body');
956
+ });
957
+ },
958
+
959
+ _doFocus: function(evt){
960
+ return this._focusCell(evt) || this._focusCell(0, -1, -1);
961
+ },
962
+
963
+ _focusCell: function(evt, rowVisIdx, colIdx){
964
+ var t = this,
965
+ g = t.grid;
966
+ g.focus.stopEvent(evt);
967
+ colIdx = colIdx >= 0 ? colIdx : t._focusCellCol;
968
+ rowVisIdx = rowVisIdx >= 0 ? rowVisIdx : t._focusCellRow;
969
+ var colId = g._columns[colIdx]? g._columns[colIdx].id : undefined,
970
+ n = t.getCellNode({
971
+ visualIndex: rowVisIdx,
972
+ colId: colId
973
+ });
974
+ if(n){
975
+ t._blurCell();
976
+ domClass.add(n, 'gridxCellFocus');
977
+ t._focusCellRow = rowVisIdx;
978
+ t._focusCellCol = colIdx;
979
+ g.header._focusHeaderId = colId;
980
+
981
+ if(has('ie') < 8){
982
+ //In IE7 focus cell node will scroll grid to the left most.
983
+ //So save the scrollLeft first and then set it back.
984
+ //FIXME: this still makes the grid body shake, any better solution?
985
+ var scrollLeft = g.bodyNode.scrollLeft;
986
+ n.focus();
987
+ g.bodyNode.scrollLeft = scrollLeft;
988
+ }else{
989
+ n.focus();
990
+ }
991
+ g.hScroller.scrollToColumn(colId, n.parentNode.parentNode.parentNode.parentNode);//this is for columnlock hack
992
+ }else if(!g.rowCount()){
993
+ g.emptyNode.focus();
994
+ return true;
995
+ }
996
+ return n;
997
+ },
998
+
999
+ _moveFocus: function(rowStep, colStep, evt){
1000
+ if(rowStep || colStep){
1001
+ var r, c,
1002
+ t = this,
1003
+ g = t.grid,
1004
+ columnCount = g._columns.length,
1005
+ vc = g.view.visualCount;
1006
+ g.focus.stopEvent(evt); //Prevent scrolling the whole page.
1007
+ r = t._focusCellRow + rowStep;
1008
+ r = r < 0 ? 0 : (r >= vc ? vc - 1 : r);
1009
+ c = t._focusCellCol + colStep;
1010
+ c = c < 0 ? 0 : (c >= columnCount ? columnCount - 1 : c);
1011
+ g.vScroller.scrollToRow(r).then(function(){
1012
+ t._focusCell(0, r, c);
1013
+ t.onMoveToCell(r, c, evt);
1014
+ });
1015
+ }
1016
+ },
1017
+
1018
+ _nextCell: function(r, c, dir, checker){
1019
+ var d = new Deferred(),
1020
+ g = this.grid,
1021
+ cc = g._columns.length,
1022
+ rc = g.view.visualCount;
1023
+ do{
1024
+ c += dir;
1025
+ if(c < 0 || c >= cc){
1026
+ r += dir;
1027
+ c = c < 0 ? cc - 1 : 0;
1028
+ if(r < 0){
1029
+ r = rc - 1;
1030
+ c = cc - 1;
1031
+ }else if(r >= rc){
1032
+ r = 0;
1033
+ c = 0;
1034
+ }
1035
+ }
1036
+ }while(!checker(r, c));
1037
+ g.vScroller.scrollToRow(r).then(function(){
1038
+ g.hScroller.scrollToColumn(g._columns[c].id);
1039
+ d.callback({r: r, c: c});
1040
+ });
1041
+ return d;
1042
+ },
1043
+
1044
+ _blurCell: function(){
1045
+ return !!query('.gridxCellFocus', this.domNode).removeClass('gridxCellFocus');
1046
+ },
1047
+
1048
+ _onFocus: function(evt){
1049
+ var bn = this.domNode,
1050
+ nl = query(evt.target).closest('.gridxCell', bn);
1051
+ if(nl[0]){
1052
+ var colIndex = this.grid._columnsById[nl[0].getAttribute('colid')].index,
1053
+ visualIndex = parseInt(nl.closest('.gridxRow', bn)[0].getAttribute('visualindex'), 10);
1054
+ return this._focusCell(0, visualIndex, colIndex);
1055
+ }
1056
+ return false;
1057
+ }
1058
+ });
1059
+ });