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,1024 @@
1
+ define([
2
+ /*====="../core/Column", =====*/
3
+ /*====="../core/Cell", =====*/
4
+ "dojo/_base/declare",
5
+ "dojo/_base/lang",
6
+ "dojo/query",
7
+ "dojo/_base/json",
8
+ "dojo/_base/Deferred",
9
+ "dojo/_base/sniff",
10
+ 'dojo/_base/array',
11
+ "dojo/DeferredList",
12
+ "dojo/dom-class",
13
+ "dojo/dom-style",
14
+ "dojo/dom-geometry",
15
+ "dojo/dom-construct",
16
+ "dojo/keys",
17
+ "dijit/a11y",
18
+ "../core/_Module",
19
+ "dojo/date/locale",
20
+ '../core/model/extensions/Modify',
21
+ 'dojo/_base/event',
22
+ "dijit/form/TextBox"
23
+ // "dojo/NodeList-traverse"
24
+ ], function(/*=====Column, Cell, =====*/declare, lang, query, json, Deferred, has, array, DeferredList, domClass, domStyle, domGeo, domConstruct, keys, a11y, _Module, locale, Modify, event){
25
+
26
+ /*=====
27
+ Cell.beginEdit = function(){
28
+ // summary:
29
+ // Begin editing mode on this cell
30
+ };
31
+
32
+ Cell.cancelEdit = function(){
33
+ // summary:
34
+ // Cancel editing mode on this cell.
35
+ };
36
+
37
+ Cell.applyEdit = function(){
38
+ // summary:
39
+ // Apply change to store for this cell
40
+ };
41
+
42
+ Cell.isEditing = function(){
43
+ // summary:
44
+ // Check whether this cell is in editing mode.
45
+ };
46
+
47
+ Cell.editor = function(){
48
+ // summary:
49
+ // Get the editor in this cell if it is in editing mode.
50
+ };
51
+
52
+ Column.isEditable = function(){
53
+ // summary:
54
+ // Check if the cells in this column are editable.
55
+ };
56
+
57
+ Column.isAlwaysEditing = function(){
58
+ // summary:
59
+ // Check if the cells in this column are always editing.
60
+ };
61
+
62
+ Column.setEditable = function(editable){
63
+ // summary:
64
+ // Set editable to the cells of this column
65
+ };
66
+
67
+ Column.editor = function(){
68
+ // summary:
69
+ // Get predefined editor for cells in this column
70
+ };
71
+
72
+ Column.setEditor = function(dijitClass, args){
73
+ // summary:
74
+ // Set editor for cells in this column
75
+ // dijitClass:
76
+ // The dijit class to be used as the editor.
77
+ // args: Edit.__EditorArgs
78
+ // Any args that are related to this editor.
79
+ };
80
+
81
+ var Edit = declare(_Module, {
82
+ // summary:
83
+ // module name: edit.
84
+ // This module provides editing mode for grid cells.
85
+ // description:
86
+ // This module relies on an implementation of the CellWidget module.
87
+ // The editing mode means there will be an editable widget appearing in the grid cell.
88
+ // This implementation also covers "alwaysEditing" mode for grid columns,
89
+ // which means all the cells in this column are always in editing mode.
90
+
91
+ begin: function(rowId, colId){
92
+ // summary:
93
+ // Begin to edit a cell with defined editor widget.
94
+ // rowId: String
95
+ // The row ID of this cell
96
+ // colId: String
97
+ // The column ID of this cell
98
+ // returns:
99
+ // A deferred object indicating when the cell has completely changed into eidting mode.
100
+ },
101
+
102
+ cancel: function(rowId, colId){
103
+ // summary:
104
+ // Cancel the edit. And end the editing state.
105
+ // rowId: String
106
+ // The row ID of this cell
107
+ // colId: String
108
+ // The column ID of this cell
109
+ // returns:
110
+ // A deferred object indicating when the cell value has been successfully restored.
111
+ },
112
+
113
+ apply: function(rowId, colId){
114
+ // summary:
115
+ // Apply the edit value to the grid store. And end the editing state.
116
+ // rowId: String
117
+ // The row ID of this cell
118
+ // colId: String
119
+ // The column ID of this cell
120
+ // returns:
121
+ // A deferred object indicating when the change has been written back to the store.
122
+ },
123
+
124
+ isEditing: function(rowId, colId){
125
+ // summary:
126
+ // Check whether a cell is in editing mode.
127
+ // rowId: String
128
+ // The row ID of this cell
129
+ // colId: String
130
+ // The column ID of this cell
131
+ // returns:
132
+ // Whether the cell is in eidting mode.
133
+ },
134
+
135
+ setEditor: function(colId, editor, args){
136
+ // summary:
137
+ // Define the editor widget to edit a column of a grid.
138
+ // The widget should have a get and set method to get value and set value.
139
+ // colId: String
140
+ // A column ID
141
+ // editor: Function|String
142
+ // Class constructor or declared name of an editor widget
143
+ // args: __GridCellEditorArgs?
144
+ // Any args that are related to this editor.
145
+ },
146
+
147
+ onBegin: function(cell){
148
+ // summary:
149
+ // Fired when a cells enters editing mode.
150
+ // cell: gridx.core.Cell
151
+ // The cell object
152
+ },
153
+
154
+ onApply: function(cell, applySuccess){
155
+ // summary:
156
+ // Fired when the change in a cell is applied to the store.
157
+ // cell: gridx.core.Cell
158
+ // The cell object
159
+ // applySuccess: Boolean
160
+ // Whether the change is successfully applied to the store
161
+ },
162
+
163
+ onCancel: function(cell){
164
+ // summary:
165
+ // Fired when an editing cell is canceled.
166
+ // cell: gridx.core.Cell
167
+ // The cell object
168
+ }
169
+ });
170
+
171
+ Edit.__EditorArgs = declare([], {
172
+ // summary:
173
+ // Arguments for the editor.
174
+
175
+ // props: String
176
+ // The properties to be used when creating the dijit in a editing cell.
177
+ // Just like data-dojo-props for a widget.
178
+ props: '',
179
+
180
+ // applyDelay: Integer
181
+ // When alwaysEditing, this is the timeout to apply changes when onChange event of editor is fired.
182
+ applyDelay: 500,
183
+
184
+ // constraints: Object
185
+ // If the editor widget has some constraints, it can be set here instead of in props.
186
+ constraints: null,
187
+
188
+ // useGridData: Boolean
189
+ // Whether to feed the editor with grid data or store data.
190
+ // This property is only effective when toEditor is not provided.
191
+ useGridData: false,
192
+
193
+ // valueField: String
194
+ // The property name of the editor used to take the data. In most cases it is "value",
195
+ // so editor.set('value', ...) can do the job.
196
+ valueField: 'value',
197
+
198
+ toEditor: function(storeData, gridData){
199
+ // summary:
200
+ // By default the dijit used in an editing cell will use store value.
201
+ // If this default behavior can not meet the requirement (for example, store data is freely formatted date string,
202
+ // while the dijit is dijit.form.DateTextBox, which requires a Date object), this function can be used.
203
+ },
204
+
205
+ fromEditor: function(valueInEditor){
206
+ // summary:
207
+ // By default when applying an editing cell, the value of the editor dijit will be retreived by get('value') and
208
+ // directly set back to the store. If this can not meet the requirement, this getEditorValue function can be used
209
+ // to get a suitable value from editor.
210
+ }
211
+ });
212
+
213
+ Edit.__ColumnDefinition = declare([], {
214
+ // summary:
215
+ // Column definition parameters defined by Edit.
216
+
217
+ // editable: Boolean
218
+ // If true then the cells in this column will be editable. Default is false.
219
+ editable: false,
220
+
221
+ canEdit: function(cell){
222
+ // summary:
223
+ // Decide whether a cell is editable.
224
+ // This makes it possible to config some cells to be uneditable in an edtibale column.
225
+ // cell: gridx.core.Cell
226
+ // The cell object
227
+ // returns:
228
+ // True if this cell should be editable, false if not.
229
+ },
230
+
231
+ // alwaysEditing: Boolean
232
+ // If true then the cells in this column will always be in editing mode. Default is false.
233
+ alwaysEditing: false,
234
+
235
+ // editor: Widget Class (Function) | String
236
+ // Set the dijit/widget to be used when a cell is in editing mode.
237
+ // The default dijit is dijit.form.TextBox.
238
+ // This attribute can either be the declared class name of a dijit or
239
+ // the class construct function of a dijit (the one that is used behide "new" keyword).
240
+ editor: '',
241
+
242
+ onEditorCreated: function(editor, column){
243
+ // summary:
244
+ // Fired when an editor is created.
245
+ // editor: Widget
246
+ // The created editor widget.
247
+ // column: gridx.core.Column
248
+ // The column this cell widget is created for.
249
+ // tags:
250
+ // callback
251
+ },
252
+
253
+ initializeEditor: function(editor, cell){
254
+ // summary:
255
+ // Do special initialization for the current cell.
256
+ // Called every time a cell widget is applied into a cell, no matter if it is just created or reused.
257
+ // editor: Widget
258
+ // The created editor widget.
259
+ },
260
+
261
+ uninitializeEditor: function(editor, cell){
262
+ // summary:
263
+ // Called every time a cell widget is reused to a cell.
264
+ // editor: Widget
265
+ // The created editor widget.
266
+ },
267
+
268
+ getEditorConnects: function(editor, cell){
269
+ },
270
+
271
+ // editorArgs: Edit.__EditorArgs
272
+ editorArgs: null,
273
+
274
+ customApplyEdit: function(cell, value){
275
+ // summary:
276
+ // If editing a cell is not as simple as setting a value to a store field, custom logic can be put here.
277
+ // For example, setting multiple fields of store for a formatted cell.
278
+ // Can return a Deferred object if the work can not be done synchronously.
279
+ }
280
+ });
281
+
282
+ return Edit;
283
+ =====*/
284
+
285
+ function getTypeData(col, storeData, gridData, cell){
286
+ if(col.storePattern && (col.dataType == 'date' || col.dataType == 'time')){
287
+ return locale.parse(storeData, col.storePattern);
288
+ }
289
+ //Some editor like textbox will ignore setting undefined value.
290
+ return gridData === undefined ? null : gridData;
291
+ }
292
+
293
+ function dateTimeFormatter(field, parseArgs, formatArgs, rawData){
294
+ var d = locale.parse(rawData[field], parseArgs);
295
+ return d ? locale.format(d, formatArgs) : rawData[field];
296
+ }
297
+
298
+ function getEditorValueSetter(toEditor){
299
+ return toEditor && function(gridData, storeData, cellWidget){
300
+ var editor = cellWidget.gridCellEditField,
301
+ cell = cellWidget.cell,
302
+ editorArgs = cell.column.editorArgs;
303
+ editor.set(editorArgs && editorArgs.valueField || 'value', toEditor(storeData, gridData, cell, editor));
304
+ };
305
+ }
306
+
307
+ return declare(_Module, {
308
+ name: 'edit',
309
+
310
+ forced: ['cellWidget'],
311
+
312
+ modelExtensions: [Modify],
313
+
314
+ constructor: function(){
315
+ this._init();
316
+ },
317
+
318
+ getAPIPath: function(){
319
+ return {
320
+ edit: this
321
+ };
322
+ },
323
+
324
+ preload: function(){
325
+ var t = this,
326
+ g = t.grid;
327
+
328
+ if(t.arg('lazySave')){
329
+ var _removeCellBackground = function(cell){
330
+ var node = cell.node();
331
+ cellBgNode = query('.gridxCellBg', node);
332
+ if(cellBgNode.length){
333
+ domConstruct.destroy(cellBgNode);
334
+ }
335
+ };
336
+
337
+ var _addCellBackground = function(cell){
338
+ var node = cell.node(),
339
+ cellBgNode = query('.gridxCellBg', node),
340
+ rowId = cell.row.id,
341
+ colId = cell.column.id,
342
+ visualIndex = cell.row.visualIndex(),
343
+ gridxRelaPath = function(){
344
+ var p= dojo.config.packages || {};
345
+
346
+ for(var i in p){
347
+ if(p[i].name == 'gridx'){
348
+ var l = p[i].location;
349
+ return l[l.length - 1] == '/' ? l : l + '/';
350
+ }
351
+ }
352
+ return '';
353
+ };
354
+
355
+ if(!cellBgNode.length){
356
+ var computedStyle = domStyle.getComputedStyle(node),
357
+ cellPadding= parseInt(domGeo.getPadBorderExtents(node, computedStyle).l, 10),
358
+ leftToMove = node.clientWidth - cellPadding - 5,
359
+
360
+ html = [
361
+ "<div rowid='" + rowId + "' ",
362
+ "colid='" + colId + "' ",
363
+ "class='gridxCellEditedBg'><span>◥</span></div>"
364
+ ].join('');
365
+
366
+ cellBgNode = domConstruct.toDom(html);
367
+ domConstruct.place(cellBgNode, cell.node(), 'first');
368
+
369
+ currentLeft = cellBgNode.offsetLeft;
370
+ currentLeft += leftToMove;
371
+
372
+ var upperRows = query('.gridxRow[visualIndex]', g.bodyNode),
373
+ top = 0;
374
+ array.forEach(upperRows, function(row){
375
+ var vi = parseInt(row.getAttribute('visualIndex'), 10);
376
+ if(vi < visualIndex){
377
+ top += row.clientHeight;
378
+ }
379
+ });
380
+
381
+ domStyle.set(cellBgNode, 'left', currentLeft + 'px');
382
+ domStyle.set(cellBgNode, 'top', top+ 'px');
383
+ }
384
+ };
385
+
386
+ var _onAftercell = function(cell){
387
+ var node = cell.node(),
388
+ rowId = cell.row.id,
389
+ colId = cell.column.id,
390
+ visualIndex = cell.row.visualIndex();
391
+
392
+ if(t.model.isChanged(rowId, g._columnsById[colId].field)){
393
+ g.body.addClass(rowId, colId, 'gridxCellChanged');
394
+ _addCellBackground(cell);
395
+ }else{
396
+ g.body.removeClass(rowId, colId, 'gridxCellChanged');
397
+ _removeCellBackground(cell);
398
+ }
399
+ };
400
+
401
+ t.connect(g.body, 'onAfterRow', function(row){
402
+ var cols = g._columnsById;
403
+ query('.gridxCell', row.node()).forEach(function(node){
404
+ var colid = node.getAttribute('colid');
405
+ if(t.model.isChanged(row.id, cols[colid].field)){
406
+ g.body.addClass(row.id, colid, 'gridxCellChanged');
407
+ _addCellBackground(g.cell(row.id, colid, 1));
408
+ }else{
409
+ g.body.removeClass(row.id, colid, 'gridxCellChanged');
410
+ }
411
+ });
412
+ });
413
+
414
+ // t.connect(t.model, 'onSet', _onSet);
415
+ t.connect(g.body, 'onAfterCell', _onAftercell);
416
+ }
417
+ g.domNode.removeAttribute('aria-readonly');
418
+ t.connect(g, 'onCellDblClick', '_onUIBegin');
419
+ t.connect(g.cellWidget, 'onCellWidgetCreated', '_onCellWidgetCreated');
420
+ t.connect(g.cellWidget, 'initializeCellWidget', function(widget, cell){
421
+ var column = cell.column;
422
+ if(column.initializeEditor && widget.gridCellEditField){
423
+ column.initializeEditor(widget.gridCellEditField, cell);
424
+ }
425
+ });
426
+ t.connect(g.cellWidget, 'uninitializeCellWidget', function(widget, cell){
427
+ var column = cell.column;
428
+ if(column.uninitializeEditor && widget.gridCellEditField){
429
+ column.uninitializeEditor(widget.gridCellEditField, cell);
430
+ }
431
+ });
432
+ t.connect(g.cellWidget, 'collectCellWidgetConnects', function(widget, output){
433
+ var column = widget.cell.column;
434
+ if(column.getEditorConnects){
435
+ var cnnts = column.getEditorConnects(widget, widget.cell);
436
+ output.push.apply(output, cnnts);
437
+ }
438
+ });
439
+ t.connect(g.body, 'onAfterRow', function(row){
440
+ query('.gridxCell', row.node()).forEach(function(node){
441
+ // var colid = node.getAttribute('colid');
442
+ if(g._columnsById[node.getAttribute('colid')].editable){
443
+ node.removeAttribute('aria-readonly');
444
+ }
445
+ });
446
+ });
447
+ },
448
+
449
+ lazySave: false,
450
+
451
+ load: function(){
452
+ //Must init focus after navigable cell, so that "edit" focus area will be on top of the "navigablecell" focus area.
453
+ this._initFocus();
454
+ this.loaded.callback();
455
+ },
456
+
457
+ cellMixin: {
458
+ beginEdit: function(){
459
+ return this.grid.edit.begin(this.row.id, this.column.id);
460
+ },
461
+
462
+ cancelEdit: function(){
463
+ return this.grid.edit.cancel(this.row.id, this.column.id);
464
+ },
465
+
466
+ applyEdit: function(){
467
+ return this.grid.edit.apply(this.row.id, this.column.id);
468
+ },
469
+
470
+ isEditing: function(){
471
+ return this.grid.edit.isEditing(this.row.id, this.column.id);
472
+ },
473
+
474
+ editor: function(){
475
+ return this.grid.edit.getEditor(this.row.id, this.column.id);
476
+ },
477
+
478
+ isEditable: function(){
479
+ var col = this.column;
480
+ return col.isEditable() && (!col.canEdit || col.canEdit(this));
481
+ }
482
+ },
483
+
484
+ columnMixin: {
485
+ isEditable: function(){
486
+ var col = this.grid._columnsById[this.id];
487
+ return col.editable;
488
+ },
489
+
490
+ isAlwaysEditing: function(){
491
+ return this.grid._columnsById[this.id].alwaysEditing;
492
+ },
493
+
494
+ setEditable: function(editable){
495
+ this.grid._columnsById[this.id].editable = !!editable;
496
+ return this;
497
+ },
498
+
499
+ editor: function(){
500
+ return this.grid._columnsById[this.id].editor;
501
+ },
502
+
503
+ setEditor: function(/*dijit|short name*/dijitClass, args){
504
+ this.grid.edit.setEditor(this.id, dijitClass, args);
505
+ return this;
506
+ }
507
+ },
508
+
509
+ //Public------------------------------------------------------------------------------
510
+ begin: function(rowId, colId){
511
+ var d = new Deferred(),
512
+ t = this,
513
+ g = t.grid;
514
+ if(!t.isEditing(rowId, colId)){
515
+ var row = g.row(rowId, 1), //1 as true
516
+ col = g._columnsById[colId];
517
+ if(row && row.cell(colId, 1).isEditable()){
518
+ g.cellWidget.setCellDecorator(rowId, colId,
519
+ t._getDecorator(colId),
520
+ getEditorValueSetter((col.editorArgs && col.editorArgs.toEditor) ||
521
+ lang.partial(getTypeData, col)));
522
+ t._record(rowId, colId);
523
+ g.body.refreshCell(row.visualIndex(), col.index).then(function(){
524
+ g.resize();
525
+ t._focusEditor(rowId, colId);
526
+ d.callback(true);
527
+ t.onBegin(g.cell(rowId, colId, 1));
528
+ });
529
+ }else{
530
+ d.callback(false);
531
+ }
532
+ }else{
533
+ t._record(rowId, colId);
534
+ t._focusEditor(rowId, colId);
535
+ d.callback(true);
536
+ t.onBegin(g.cell(rowId, colId, 1));
537
+ }
538
+ return d;
539
+ },
540
+
541
+ cancel: function(rowId, colId){
542
+ var d = new Deferred(),
543
+ t = this,
544
+ g = t.grid,
545
+ m = t.model,
546
+ row = g.row(rowId, 1);
547
+ if(row){
548
+ var cw = g.cellWidget,
549
+ col = g._columnsById[colId];
550
+ if(col){
551
+ if(col.alwaysEditing){
552
+ var rowCache = m.byId(rowId);
553
+ cw = cw.getCellWidget(rowId, colId);
554
+ cw.setValue(rowCache.data[colId], rowCache.rawData[col.field]);
555
+ d.callback();
556
+ t.onCancel(g.cell(rowId, colId, 1));
557
+ }else{
558
+ t._erase(rowId, colId);
559
+ cw.restoreCellDecorator(rowId, colId);
560
+ g.body.refreshCell(row.visualIndex(), col.index).then(function(){
561
+ d.callback();
562
+ t.onCancel(g.cell(rowId, colId, 1));
563
+ });
564
+ }
565
+ }
566
+ }else{
567
+ d.callback();
568
+ }
569
+ return d;
570
+ },
571
+
572
+ apply: function(rowId, colId){
573
+ var d = new Deferred(),
574
+ t = this,
575
+ g = t.grid,
576
+ cell = g.cell(rowId, colId, 1);
577
+ if(cell){
578
+ var widget = g.cellWidget.getCellWidget(rowId, colId),
579
+ editor = widget && widget.gridCellEditField;
580
+ if(editor && (!lang.isFunction(editor.isValid) || editor.isValid())){
581
+ var editorArgs = cell.column.editorArgs,
582
+ valueField = editorArgs && editorArgs.valueField || 'value',
583
+ v = editor.get(valueField),
584
+ finish = function(success, e){
585
+ if(!success){
586
+ console.warn('Can not apply change! Error message: ', e);
587
+ }
588
+ t._erase(rowId, colId);
589
+ if(cell.column.alwaysEditing){
590
+ d.callback(success);
591
+ t.onApply(cell, success, e, t.arg('lazy'));
592
+ }else{
593
+ g.cellWidget.restoreCellDecorator(rowId, colId);
594
+ g.body.refreshCell(cell.row.visualIndex(), cell.column.index()).then(function(){
595
+ d.callback(success);
596
+ g.resize();
597
+ t.onApply(cell, success, e, t.arg('lazy'));
598
+ });
599
+ }
600
+ };
601
+ try{
602
+ if(editorArgs && editorArgs.fromEditor){
603
+ v = editorArgs.fromEditor(v, widget.cell);
604
+ }else if(cell.column.storePattern){
605
+ v = locale.format(v, cell.column.storePattern);
606
+ }
607
+ if(lang.isFunction(cell.column.customApplyEdit)){
608
+ Deferred.when(cell.column.customApplyEdit(cell, v), function(){
609
+ finish(true);
610
+ }, function(e){
611
+ finish(false, e);
612
+ });
613
+ }else if(cell.rawData() === v){
614
+ finish(true);
615
+ }else{
616
+ if(t.arg('lazySave')){
617
+ var f = g._columnsById[colId].field,
618
+ obj = {};
619
+
620
+ obj[f] = v;
621
+ t.model.set(rowId, obj);
622
+ finish(true);
623
+ }else{
624
+ Deferred.when(cell.setRawData(v), function(){
625
+ finish(true);
626
+ }, function(e){
627
+ finish(false, e);
628
+ });
629
+ }
630
+ }
631
+ }catch(e){
632
+ finish(false, e);
633
+ }
634
+ return d;
635
+ }
636
+ }
637
+ d.callback(false);
638
+ return d;
639
+ },
640
+
641
+ isEditing: function(rowId, colId){
642
+ var col = this.grid._columnsById[colId];
643
+ if(col && col.alwaysEditing){
644
+ return true;
645
+ }
646
+ return !!this.getEditor(rowId, colId);
647
+ },
648
+
649
+ setEditor: function(colId, editor, args){
650
+ var col = this.grid._columnsById[colId],
651
+ editorArgs = col.editorArgs = col.editorArgs || {};
652
+ col.editor = editor;
653
+ lang.mixin(editorArgs, args || {});
654
+ },
655
+
656
+ getEditor: function(rowId, colId){
657
+ var widget = this.grid.cellWidget.getCellWidget(rowId, colId);
658
+ return widget && widget.gridCellEditField;
659
+ },
660
+
661
+ getLazyData: function(rowId, colId){
662
+ var t = this,
663
+ f = t.grid._columnsById[colId].field;
664
+
665
+ if(t.arg('lazy')){
666
+ r = t._lazyDataChangeList[rowId];
667
+ if(r){
668
+ return r[f]? r[f].list[r[f].index] : undefined;
669
+ }
670
+ }
671
+ return undefined;
672
+ },
673
+
674
+ //Events-------------------------------------------------------------------
675
+ onBegin: function(/* cell */){},
676
+
677
+ onApply: function(/* cell, applySuccess */){},
678
+
679
+ onCancel: function(/* cell */){},
680
+
681
+ //Private------------------------------------------------------------------
682
+ _init: function(){
683
+ this._editingCells = {};
684
+ this._lazyIds = {};
685
+ this._lazyData = {};
686
+ this._lazyDataChangeList = {};
687
+ this._inCallBackMode = false;
688
+
689
+ for(var i = 0, cols = this.grid._columns, len = cols.length; i < len; ++i){
690
+ var c = cols[i];
691
+ if(c.storePattern && c.field && (c.dataType == 'date' || c.dataType == 'time')){
692
+ c.gridPattern = c.gridPattern ||
693
+ (!lang.isFunction(c.formatter) &&
694
+ (lang.isObject(c.formatter) ||
695
+ typeof c.formatter == 'string') &&
696
+ c.formatter) ||
697
+ c.storePattern;
698
+ var pattern;
699
+ if(lang.isString(c.storePattern)){
700
+ pattern = c.storePattern;
701
+ c.storePattern = {};
702
+ c.storePattern[c.dataType + 'Pattern'] = pattern;
703
+ }
704
+ c.storePattern.selector = c.dataType;
705
+ if(lang.isString(c.gridPattern)){
706
+ pattern = c.gridPattern;
707
+ c.gridPattern = {};
708
+ c.gridPattern[c.dataType + 'Pattern'] = pattern;
709
+ }
710
+ c.gridPattern.selector = c.dataType;
711
+ c.formatter = lang.partial(dateTimeFormatter, c.field, c.storePattern, c.gridPattern);
712
+ }
713
+ }
714
+ this._initAlwaysEdit();
715
+ },
716
+
717
+ _initAlwaysEdit: function(){
718
+ var t = this;
719
+ array.forEach(t.grid._columns, function(col){
720
+ if(col.alwaysEditing){
721
+ col.editable = true;
722
+ col.navigable = true;
723
+ var needCellWidget = col.needCellWidget;
724
+ col.needCellWidget = function(cell){
725
+ return (!needCellWidget || needCellWidget.apply(col, arguments)) && cell.isEditable();
726
+ };
727
+ col._userDec = col.decorator;
728
+ col.userDecorator = t._getDecorator(col.id);
729
+ col.setCellValue = getEditorValueSetter((col.editorArgs && col.editorArgs.toEditor) ||
730
+ lang.partial(getTypeData, col));
731
+ col.decorator = t._dummyDecorator;
732
+ //FIXME: this breaks encapsulation
733
+ col._cellWidgets = {};
734
+ col._backupWidgets = [];
735
+ }
736
+ });
737
+ },
738
+
739
+ _dummyDecorator: function(data, rowId, visualIndex, cell){
740
+ var column = cell.column;
741
+ if(!column.needCellWidget || column.needCellWidget(cell)){
742
+ return '';
743
+ }
744
+ //If not editable, allow user decorator to take effect.
745
+ if(column._userDec){
746
+ return column._userDec(data, rowId, visualIndex, cell);
747
+ }
748
+ return data;
749
+ },
750
+
751
+ _getColumnEditor: function(colId){
752
+ var editor = this.grid._columnsById[colId].editor;
753
+ if(lang.isFunction(editor)){
754
+ return editor.prototype.declaredClass;
755
+ }else if(lang.isString(editor)){
756
+ return editor;
757
+ }else{
758
+ return 'dijit.form.TextBox';
759
+ }
760
+ },
761
+
762
+ _onCellWidgetCreated: function(widget, column){
763
+ var t = this,
764
+ editor = widget.gridCellEditField;
765
+ if(editor){
766
+ if(column.alwaysEditing){
767
+ widget.connect(editor, 'onChange', function(){
768
+ var rn = widget.domNode.parentNode;
769
+ while(rn && !domClass.contains(rn, 'gridxRow')){
770
+ rn = rn.parentNode;
771
+ }
772
+ if(rn){
773
+ //TODO: is 500ms okay?
774
+ var delay = column.editorArgs && column.editorArgs.applyDelay || 500;
775
+ clearTimeout(editor._timeoutApply);
776
+ editor._timeoutApply = setTimeout(function(){
777
+ t.apply(rn.getAttribute('rowid'), column.id);
778
+ }, delay);
779
+ }
780
+ });
781
+ }
782
+ if(column.onEditorCreated){
783
+ column.onEditorCreated(editor, column);
784
+ }
785
+ }
786
+ },
787
+
788
+ _focusEditor: function(rowId, colId, forced){
789
+ var editor = this.getEditor(rowId, colId);
790
+ if(editor && !editor.focused && lang.isFunction(editor.focus) || forced){
791
+ this.grid.hScroller.scrollToColumn(colId);
792
+ editor.focus();
793
+ }
794
+ },
795
+
796
+ _getDecorator: function(colId){
797
+ var className = this._getColumnEditor(colId),
798
+ p, properties,
799
+ col = this.grid._columnsById[colId],
800
+ editorArgs = col.editorArgs || {},
801
+ useGridData = editorArgs.useGridData,
802
+ constraints = editorArgs.constraints || {},
803
+ props = editorArgs.props || '',
804
+ pattern = col.gridPattern || col.storePattern,
805
+ textDir = col.textDir || this.grid.textDir;
806
+ if(pattern){
807
+ constraints = lang.mixin({}, pattern, constraints);
808
+ }
809
+ constraints = json.toJson(constraints);
810
+ constraints = constraints.substring(1, constraints.length - 1);
811
+ if(textDir){
812
+ props += [(props ? ', ' : ''),
813
+ 'dir: "', (this.grid.isLeftToRight() ? 'ltr' : 'rtl'),
814
+ '", textDir: "', textDir, (constraints ? '", ' : '"')
815
+ ].join('');
816
+ }else if(props && constraints){
817
+ props += ', ';
818
+ }
819
+ return function(){
820
+ return ["<div data-dojo-type='", className, "' ",
821
+ "data-dojo-attach-point='gridCellEditField' ",
822
+ "class='gridxCellEditor gridxHasGridCellValue ",
823
+ useGridData ? "" : "gridxUseStoreData",
824
+ "' data-dojo-props='",
825
+ props, constraints,
826
+ "'></div>"
827
+ ].join('');
828
+ };
829
+ },
830
+
831
+ _record: function(rowId, colId){
832
+ var cells = this._editingCells, r = cells[rowId];
833
+ if(!r){
834
+ r = cells[rowId] = {};
835
+ }
836
+ r[colId] = 1;
837
+ },
838
+
839
+ _erase: function(rowId, colId){
840
+ var cells = this._editingCells, r = cells[rowId];
841
+ if(r){
842
+ delete r[colId];
843
+ }
844
+ },
845
+
846
+ _applyAll: function(){
847
+ var cells = this._editingCells,
848
+ r, c;
849
+ for(r in cells){
850
+ for(c in cells[r]){
851
+ this.apply(r, c);
852
+ }
853
+ }
854
+ },
855
+
856
+ _onUIBegin: function(evt){
857
+ if(!this.isEditing(evt.rowId, evt.columnId)){
858
+ this._applyAll();
859
+ }
860
+ return this.begin(evt.rowId, evt.columnId);
861
+ },
862
+
863
+ //Focus-----------------------------------------------------
864
+ _initFocus: function(){
865
+ var t = this,
866
+ g = t.grid,
867
+ f = g.focus;
868
+ if(f){
869
+ f.registerArea({
870
+ name: 'edit',
871
+ priority: 1,
872
+ scope: t,
873
+ doFocus: t._onFocus,
874
+ doBlur: t._doBlur,
875
+ onFocus: t._onFocus,
876
+ onBlur: t._onBlur,
877
+ connects: [
878
+ t.connect(g, 'onCellKeyDown', '_onKey'),
879
+ t.connect(t, '_focusEditor', '_focus')
880
+ ]
881
+ });
882
+ }else{
883
+ //If not keyboard support, at least single clicking on other cells should apply the changes.
884
+ t.connect(g, 'onCellMouseDown', function(e){
885
+ var cells = t._editingCells;
886
+ if(!cells[e.rowId] || !cells[e.rowId][e.columnId]){
887
+ t._applyAll();
888
+ }
889
+ });
890
+ }
891
+ },
892
+
893
+ _onFocus: function(evt){
894
+ var t = this;
895
+ if(evt){
896
+ var n = query(evt.target).closest('.gridxCell', t.grid.bodyNode)[0];
897
+ if(n){
898
+ var colId = n.getAttribute('colid'),
899
+ rowId = n.parentNode.parentNode.parentNode.parentNode.getAttribute('rowid');
900
+ //Fix #7627: in chrome evt.target will be the cell node when using CheckBox
901
+ if(t.isEditing(rowId, colId)/* && n != evt.target*/){
902
+ t._record(rowId, colId);
903
+ //If in alwaysEditing mode, should be same as CellWidget, so ignore this "edit" focus area.
904
+ return !t.grid._columnsById[colId].alwaysEditing;
905
+ }
906
+ }
907
+ return false;
908
+ }
909
+ return t._editing;
910
+ },
911
+
912
+ _doBlur: function(evt, step){
913
+ var t = this,
914
+ g = t.grid,
915
+ view = g.view,
916
+ body = g.body;
917
+ if(t._editing && step){
918
+ var cellNode = g.body.getCellNode({
919
+ rowId: t._focusCellRow,
920
+ colId: t._focusCellCol
921
+ });
922
+ var elems = a11y._getTabNavigable(cellNode);
923
+ if(evt && evt.target == (step < 0 ? elems.first : elems.last)){
924
+ g.focus.stopEvent(evt);
925
+ var rowIndex = view.getRowInfo({
926
+ parentId: t.model.parentId(t._focusCellRow),
927
+ rowIndex: t.model.idToIndex(t._focusCellRow)
928
+ }).visualIndex,
929
+ colIndex = g._columnsById[t._focusCellCol].index,
930
+ dir = step > 0 ? 1 : -1,
931
+ checker = function(r, c){
932
+ return g._columns[c].editable;
933
+ };
934
+ body._nextCell(rowIndex, colIndex, dir, checker).then(function(obj){
935
+ t._applyAll();
936
+ t._focusCellCol = g._columns[obj.c].id;
937
+ var rowInfo = view.getRowInfo({visualIndex: obj.r});
938
+ t._focusCellRow = t.model.indexToId(rowInfo.rowIndex, rowInfo.parentId);
939
+ //This breaks encapsulation a little....
940
+ body._focusCellCol = obj.c;
941
+ body._focusCellRow = obj.r;
942
+ t.begin(t._focusCellRow, t._focusCellCol);
943
+ });
944
+ }
945
+ return false;
946
+ }
947
+ return true;
948
+ },
949
+
950
+ _onBlur: function(){
951
+ this._applyAll();
952
+ this._editing = false;
953
+ return true;
954
+ },
955
+
956
+ _focus: function(rowId, colId){
957
+ var t = this;
958
+ t._editing = true;
959
+ t._focusCellCol = colId;
960
+ t._focusCellRow = rowId;
961
+ t.grid.focus.focusArea('edit');
962
+ },
963
+
964
+ _blur: function(){
965
+ this._editing = false;
966
+ var focus = this.grid.focus;
967
+ if(focus){
968
+ if(has('ie')){
969
+ setTimeout(function(){
970
+ focus.focusArea('body');
971
+ }, 1);
972
+ }else{
973
+ focus.focusArea('body');
974
+ }
975
+ }
976
+ },
977
+
978
+ _onKey: function(e){
979
+ var t = this,
980
+ g = t.grid,
981
+ col = g._columnsById[e.columnId];
982
+ if(col.editable){
983
+ var editing = t.isEditing(e.rowId, e.columnId);
984
+ if(e.keyCode == keys.ENTER){
985
+ if(editing){
986
+ t.apply(e.rowId, e.columnId).then(function(success){
987
+ if(success){
988
+ t._blur();
989
+ }
990
+ if(col.alwaysEditing){
991
+ t._focusEditor(e.rowId, e.columnId);
992
+ }
993
+ });
994
+ }else if(g.focus.currentArea() == 'body'){
995
+ //If not doing this, some dijit, like DateTextBox/TimeTextBox will show validation error.
996
+ g.focus.stopEvent(e);
997
+ t._onUIBegin(e);
998
+ }
999
+ }else if(e.keyCode == keys.ESCAPE && editing){
1000
+ t.cancel(e.rowId, e.columnId).then(lang.hitch(t, t._blur)).then(function(){
1001
+ g.focus.focusArea('body');
1002
+ });
1003
+ }else if(e.keyCode == 'Z'.charCodeAt(0) && e.ctrlKey){
1004
+ if(t.arg('lazySave')){
1005
+ t.model.undo();
1006
+ }
1007
+ }else if(e.keyCode == 'Y'.charCodeAt(0) && e.ctrlKey){
1008
+ if(t.arg('lazySave')){
1009
+ t.model.redo();
1010
+ }
1011
+ }else if(e.keyCode == 'S'.charCodeAt(0) && e.ctrlKey){
1012
+ if(t.arg('lazySave')){
1013
+ t.model.save();
1014
+ e.preventDefault();
1015
+ }
1016
+ }
1017
+ }
1018
+ if(t._editing && e.keyCode !== keys.TAB){
1019
+ e.stopPropagation();
1020
+ }
1021
+ }
1022
+
1023
+ });
1024
+ });