gridx-rails 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/LICENSE +2 -0
- data/README.md +18 -0
- data/Rakefile +36 -0
- data/app/assets/images/gridx/mobile/themes/iphone/images/ajax-loader.gif +0 -0
- data/app/assets/images/gridx/mobile/themes/iphone/images/arrow.png +0 -0
- data/app/assets/images/gridx/resources/images/checkboxpartial.png +0 -0
- data/app/assets/images/gridx/resources/images/checkboxpartialdisabled.png +0 -0
- data/app/assets/images/gridx/resources/images/claro-grid-header-onepixel.bmp +0 -0
- data/app/assets/images/gridx/resources/images/dndCopy.png +0 -0
- data/app/assets/images/gridx/resources/images/dndMove.png +0 -0
- data/app/assets/images/gridx/resources/images/dndNoCopy.png +0 -0
- data/app/assets/images/gridx/resources/images/dndNoMove.png +0 -0
- data/app/assets/images/gridx/resources/images/gridxCellChanged.png +0 -0
- data/app/assets/images/gridx/resources/images/header.png +0 -0
- data/app/assets/images/gridx/resources/images/header_shadow.png +0 -0
- data/app/assets/images/gridx/resources/images/loadingAnimation.gif +0 -0
- data/app/assets/images/gridx/resources/images/row_back.png +0 -0
- data/app/assets/images/gridx/resources/images/row_back_changed.png +0 -0
- data/app/assets/images/gridx/resources/images/sprite_icons.png +0 -0
- data/app/assets/images/gridx/resources/images/treeExpandImages.png +0 -0
- data/app/assets/images/gridx/resources/images/treeExpand_loading.gif +0 -0
- data/app/assets/javascripts/gridx/Grid.js +224 -0
- data/app/assets/javascripts/gridx/GridCommon.js +52 -0
- data/app/assets/javascripts/gridx/allModules.js +105 -0
- data/app/assets/javascripts/gridx/core/Cell.js +86 -0
- data/app/assets/javascripts/gridx/core/Column.js +183 -0
- data/app/assets/javascripts/gridx/core/Core.js +447 -0
- data/app/assets/javascripts/gridx/core/Row.js +174 -0
- data/app/assets/javascripts/gridx/core/_Module.js +285 -0
- data/app/assets/javascripts/gridx/core/model/Model.js +495 -0
- data/app/assets/javascripts/gridx/core/model/_Extension.js +84 -0
- data/app/assets/javascripts/gridx/core/model/cache/Async.js +469 -0
- data/app/assets/javascripts/gridx/core/model/cache/Sync.js +59 -0
- data/app/assets/javascripts/gridx/core/model/cache/_Cache.js +386 -0
- data/app/assets/javascripts/gridx/core/model/extensions/ClientFilter.js +303 -0
- data/app/assets/javascripts/gridx/core/model/extensions/FormatSort.js +103 -0
- data/app/assets/javascripts/gridx/core/model/extensions/Mark.js +370 -0
- data/app/assets/javascripts/gridx/core/model/extensions/Modify.js +418 -0
- data/app/assets/javascripts/gridx/core/model/extensions/Move.js +429 -0
- data/app/assets/javascripts/gridx/core/model/extensions/Query.js +50 -0
- data/app/assets/javascripts/gridx/core/model/extensions/Sort.js +81 -0
- data/app/assets/javascripts/gridx/core/util.js +13 -0
- data/app/assets/javascripts/gridx/mobile/Grid.js +300 -0
- data/app/assets/javascripts/gridx/mobile/LazyLoad.js +88 -0
- data/app/assets/javascripts/gridx/mobile/PullRefresh.js +117 -0
- data/app/assets/javascripts/gridx/mobile/Sort.js +66 -0
- data/app/assets/javascripts/gridx/mobile/nls/LazyLoad.js +38 -0
- data/app/assets/javascripts/gridx/mobile/nls/PullRefresh.js +39 -0
- data/app/assets/javascripts/gridx/mobile/nls/ar/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/ar/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/ar/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/bg/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/bg/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/bg/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/ca/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/ca/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/ca/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/common.js +37 -0
- data/app/assets/javascripts/gridx/mobile/nls/cs/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/cs/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/cs/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/da/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/da/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/da/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/de/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/de/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/de/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/el/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/el/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/el/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/es/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/es/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/es/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/fi/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/fi/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/fi/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/fr/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/fr/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/fr/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/he/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/he/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/he/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/hr/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/hr/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/hr/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/hu/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/hu/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/hu/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/it/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/it/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/it/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/ja/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/ja/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/ja/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/kk/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/kk/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/kk/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/ko/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/ko/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/ko/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/nb/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/nb/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/nb/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/nl/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/nl/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/nl/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/pl/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/pl/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/pl/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/pt/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/pt/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/pt/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/pt-pt/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/pt-pt/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/pt-pt/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/ro/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/ro/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/ro/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/ru/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/ru/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/ru/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/sk/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/sk/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/sk/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/sl/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/sl/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/sl/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/sv/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/sv/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/sv/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/th/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/th/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/th/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/tr/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/tr/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/tr/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/uk/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/uk/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/uk/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/zh/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/zh/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/zh/common.js +5 -0
- data/app/assets/javascripts/gridx/mobile/nls/zh-tw/LazyLoad.js +6 -0
- data/app/assets/javascripts/gridx/mobile/nls/zh-tw/PullRefresh.js +7 -0
- data/app/assets/javascripts/gridx/mobile/nls/zh-tw/common.js +5 -0
- data/app/assets/javascripts/gridx/modules/AutoScroll.js +100 -0
- data/app/assets/javascripts/gridx/modules/Bar.js +322 -0
- data/app/assets/javascripts/gridx/modules/Body.js +1059 -0
- data/app/assets/javascripts/gridx/modules/CellWidget.js +538 -0
- data/app/assets/javascripts/gridx/modules/ColumnLock.js +254 -0
- data/app/assets/javascripts/gridx/modules/ColumnResizer.js +278 -0
- data/app/assets/javascripts/gridx/modules/ColumnWidth.js +320 -0
- data/app/assets/javascripts/gridx/modules/Dod.js +368 -0
- data/app/assets/javascripts/gridx/modules/Edit.js +1024 -0
- data/app/assets/javascripts/gridx/modules/Filter.js +482 -0
- data/app/assets/javascripts/gridx/modules/Focus.js +439 -0
- data/app/assets/javascripts/gridx/modules/GroupHeader.js +437 -0
- data/app/assets/javascripts/gridx/modules/HLayout.js +139 -0
- data/app/assets/javascripts/gridx/modules/HScroller.js +172 -0
- data/app/assets/javascripts/gridx/modules/Header.js +289 -0
- data/app/assets/javascripts/gridx/modules/HeaderMenu.js +63 -0
- data/app/assets/javascripts/gridx/modules/HeaderRegions.js +201 -0
- data/app/assets/javascripts/gridx/modules/HiddenColumns.js +274 -0
- data/app/assets/javascripts/gridx/modules/IndirectSelect.js +287 -0
- data/app/assets/javascripts/gridx/modules/IndirectSelectColumn.js +277 -0
- data/app/assets/javascripts/gridx/modules/Menu.js +167 -0
- data/app/assets/javascripts/gridx/modules/NavigableCell.js +170 -0
- data/app/assets/javascripts/gridx/modules/NestedSort.js +280 -0
- data/app/assets/javascripts/gridx/modules/PagedBody.js +409 -0
- data/app/assets/javascripts/gridx/modules/Pagination.js +293 -0
- data/app/assets/javascripts/gridx/modules/Persist.js +266 -0
- data/app/assets/javascripts/gridx/modules/Printer.js +49 -0
- data/app/assets/javascripts/gridx/modules/RowHeader.js +412 -0
- data/app/assets/javascripts/gridx/modules/RowLock.js +143 -0
- data/app/assets/javascripts/gridx/modules/SingleSort.js +276 -0
- data/app/assets/javascripts/gridx/modules/SummaryBar.js +33 -0
- data/app/assets/javascripts/gridx/modules/TitleBar.js +51 -0
- data/app/assets/javascripts/gridx/modules/ToolBar.js +55 -0
- data/app/assets/javascripts/gridx/modules/TouchScroll.js +103 -0
- data/app/assets/javascripts/gridx/modules/TouchVScroller.js +89 -0
- data/app/assets/javascripts/gridx/modules/Traverse.js +159 -0
- data/app/assets/javascripts/gridx/modules/Tree.js +646 -0
- data/app/assets/javascripts/gridx/modules/VLayout.js +152 -0
- data/app/assets/javascripts/gridx/modules/VScroller.js +342 -0
- data/app/assets/javascripts/gridx/modules/View.js +540 -0
- data/app/assets/javascripts/gridx/modules/VirtualVScroller.js +445 -0
- data/app/assets/javascripts/gridx/modules/barPlugins/DropDownPager.js +16 -0
- data/app/assets/javascripts/gridx/modules/barPlugins/DropDownSizer.js +16 -0
- data/app/assets/javascripts/gridx/modules/barPlugins/GotoPageButton.js +16 -0
- data/app/assets/javascripts/gridx/modules/barPlugins/LinkPager.js +16 -0
- data/app/assets/javascripts/gridx/modules/barPlugins/LinkSizer.js +16 -0
- data/app/assets/javascripts/gridx/modules/barPlugins/Summary.js +16 -0
- data/app/assets/javascripts/gridx/modules/dnd/Avatar.js +45 -0
- data/app/assets/javascripts/gridx/modules/dnd/Column.js +210 -0
- data/app/assets/javascripts/gridx/modules/dnd/Row.js +286 -0
- data/app/assets/javascripts/gridx/modules/dnd/_Base.js +60 -0
- data/app/assets/javascripts/gridx/modules/dnd/_Dnd.js +371 -0
- data/app/assets/javascripts/gridx/modules/exporter/CSV.js +43 -0
- data/app/assets/javascripts/gridx/modules/exporter/Exporter.js +34 -0
- data/app/assets/javascripts/gridx/modules/exporter/Table.js +42 -0
- data/app/assets/javascripts/gridx/modules/extendedSelect/Cell.js +491 -0
- data/app/assets/javascripts/gridx/modules/extendedSelect/Column.js +290 -0
- data/app/assets/javascripts/gridx/modules/extendedSelect/Row.js +458 -0
- data/app/assets/javascripts/gridx/modules/extendedSelect/_Base.js +244 -0
- data/app/assets/javascripts/gridx/modules/extendedSelect/_RowCellBase.js +35 -0
- data/app/assets/javascripts/gridx/modules/filter/DistinctComboBoxMenu.js +22 -0
- data/app/assets/javascripts/gridx/modules/filter/Filter.js +16 -0
- data/app/assets/javascripts/gridx/modules/filter/FilterBar.js +649 -0
- data/app/assets/javascripts/gridx/modules/filter/FilterConfirmDialog.js +33 -0
- data/app/assets/javascripts/gridx/modules/filter/FilterDialog.js +179 -0
- data/app/assets/javascripts/gridx/modules/filter/FilterPane.js +340 -0
- data/app/assets/javascripts/gridx/modules/filter/FilterTooltip.js +103 -0
- data/app/assets/javascripts/gridx/modules/filter/QuickFilter.js +33 -0
- data/app/assets/javascripts/gridx/modules/move/Column.js +223 -0
- data/app/assets/javascripts/gridx/modules/move/Row.js +154 -0
- data/app/assets/javascripts/gridx/modules/pagination/Pagination.js +16 -0
- data/app/assets/javascripts/gridx/modules/pagination/PaginationBar.js +68 -0
- data/app/assets/javascripts/gridx/modules/pagination/PaginationBarDD.js +40 -0
- data/app/assets/javascripts/gridx/modules/pagination/_PaginationBarBase.js +105 -0
- data/app/assets/javascripts/gridx/modules/select/Cell.js +229 -0
- data/app/assets/javascripts/gridx/modules/select/Column.js +209 -0
- data/app/assets/javascripts/gridx/modules/select/Row.js +302 -0
- data/app/assets/javascripts/gridx/modules/select/_Base.js +99 -0
- data/app/assets/javascripts/gridx/modules/select/_RowCellBase.js +51 -0
- data/app/assets/javascripts/gridx/nls/Body.js +47 -0
- data/app/assets/javascripts/gridx/nls/FilterBar.js +133 -0
- data/app/assets/javascripts/gridx/nls/NestedSort.js +45 -0
- data/app/assets/javascripts/gridx/nls/PaginationBar.js +68 -0
- data/app/assets/javascripts/gridx/nls/QuickFilter.js +40 -0
- data/app/assets/javascripts/gridx/nls/SummaryBar.js +38 -0
- data/app/assets/javascripts/gridx/nls/ar/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/ar/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/ar/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/ar/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/ar/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/ar/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/bg/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/bg/FilterBar.js +88 -0
- data/app/assets/javascripts/gridx/nls/bg/NestedSort.js +12 -0
- data/app/assets/javascripts/gridx/nls/bg/PaginationBar.js +28 -0
- data/app/assets/javascripts/gridx/nls/bg/QuickFilter.js +8 -0
- data/app/assets/javascripts/gridx/nls/bg/SummaryBar.js +6 -0
- data/app/assets/javascripts/gridx/nls/ca/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/ca/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/ca/NestedSort.js +13 -0
- data/app/assets/javascripts/gridx/nls/ca/PaginationBar.js +30 -0
- data/app/assets/javascripts/gridx/nls/ca/QuickFilter.js +9 -0
- data/app/assets/javascripts/gridx/nls/ca/SummaryBar.js +7 -0
- data/app/assets/javascripts/gridx/nls/cs/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/cs/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/cs/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/cs/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/cs/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/cs/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/da/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/da/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/da/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/da/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/da/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/da/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/de/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/de/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/de/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/de/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/de/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/de/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/el/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/el/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/el/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/el/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/el/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/el/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/es/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/es/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/es/NestedSort.js +13 -0
- data/app/assets/javascripts/gridx/nls/es/PaginationBar.js +30 -0
- data/app/assets/javascripts/gridx/nls/es/QuickFilter.js +9 -0
- data/app/assets/javascripts/gridx/nls/es/SummaryBar.js +7 -0
- data/app/assets/javascripts/gridx/nls/fi/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/fi/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/fi/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/fi/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/fi/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/fi/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/fr/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/fr/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/fr/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/fr/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/fr/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/fr/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/he/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/he/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/he/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/he/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/he/QuickFilter.js +6 -0
- data/app/assets/javascripts/gridx/nls/he/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/hr/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/hr/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/hr/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/hr/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/hr/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/hr/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/hu/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/hu/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/hu/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/hu/PaginationBar.js +33 -0
- data/app/assets/javascripts/gridx/nls/hu/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/hu/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/it/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/it/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/it/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/it/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/it/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/it/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/ja/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/ja/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/ja/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/ja/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/ja/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/ja/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/kk/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/kk/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/kk/NestedSort.js +13 -0
- data/app/assets/javascripts/gridx/nls/kk/PaginationBar.js +30 -0
- data/app/assets/javascripts/gridx/nls/kk/QuickFilter.js +9 -0
- data/app/assets/javascripts/gridx/nls/kk/SummaryBar.js +7 -0
- data/app/assets/javascripts/gridx/nls/ko/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/ko/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/ko/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/ko/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/ko/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/ko/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/nb/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/nb/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/nb/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/nb/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/nb/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/nb/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/nl/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/nl/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/nl/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/nl/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/nl/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/nl/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/pl/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/pl/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/pl/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/pl/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/pl/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/pl/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/pt/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/pt/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/pt/NestedSort.js +13 -0
- data/app/assets/javascripts/gridx/nls/pt/PaginationBar.js +30 -0
- data/app/assets/javascripts/gridx/nls/pt/QuickFilter.js +9 -0
- data/app/assets/javascripts/gridx/nls/pt/SummaryBar.js +7 -0
- data/app/assets/javascripts/gridx/nls/pt-br/Body.js +6 -0
- data/app/assets/javascripts/gridx/nls/pt-br/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/pt-br/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/pt-br/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/pt-br/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/pt-br/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/pt-pt/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/pt-pt/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/pt-pt/NestedSort.js +13 -0
- data/app/assets/javascripts/gridx/nls/pt-pt/PaginationBar.js +30 -0
- data/app/assets/javascripts/gridx/nls/pt-pt/QuickFilter.js +9 -0
- data/app/assets/javascripts/gridx/nls/pt-pt/SummaryBar.js +7 -0
- data/app/assets/javascripts/gridx/nls/ro/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/ro/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/ro/NestedSort.js +13 -0
- data/app/assets/javascripts/gridx/nls/ro/PaginationBar.js +30 -0
- data/app/assets/javascripts/gridx/nls/ro/QuickFilter.js +9 -0
- data/app/assets/javascripts/gridx/nls/ro/SummaryBar.js +7 -0
- data/app/assets/javascripts/gridx/nls/ru/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/ru/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/ru/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/ru/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/ru/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/ru/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/sk/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/sk/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/sk/NestedSort.js +13 -0
- data/app/assets/javascripts/gridx/nls/sk/PaginationBar.js +30 -0
- data/app/assets/javascripts/gridx/nls/sk/QuickFilter.js +9 -0
- data/app/assets/javascripts/gridx/nls/sk/SummaryBar.js +7 -0
- data/app/assets/javascripts/gridx/nls/sl/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/sl/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/sl/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/sl/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/sl/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/sl/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/sv/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/sv/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/sv/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/sv/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/sv/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/sv/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/th/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/th/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/th/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/th/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/th/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/th/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/tr/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/tr/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/tr/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/tr/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/tr/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/tr/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/uk/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/uk/FilterBar.js +88 -0
- data/app/assets/javascripts/gridx/nls/uk/NestedSort.js +12 -0
- data/app/assets/javascripts/gridx/nls/uk/PaginationBar.js +28 -0
- data/app/assets/javascripts/gridx/nls/uk/QuickFilter.js +8 -0
- data/app/assets/javascripts/gridx/nls/uk/SummaryBar.js +6 -0
- data/app/assets/javascripts/gridx/nls/zh/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/zh/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/zh/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/zh/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/zh/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/zh/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/nls/zh-tw/Body.js +11 -0
- data/app/assets/javascripts/gridx/nls/zh-tw/FilterBar.js +89 -0
- data/app/assets/javascripts/gridx/nls/zh-tw/NestedSort.js +11 -0
- data/app/assets/javascripts/gridx/nls/zh-tw/PaginationBar.js +34 -0
- data/app/assets/javascripts/gridx/nls/zh-tw/QuickFilter.js +7 -0
- data/app/assets/javascripts/gridx/nls/zh-tw/SummaryBar.js +5 -0
- data/app/assets/javascripts/gridx/support/DropDownPager.js +111 -0
- data/app/assets/javascripts/gridx/support/DropDownSizer.js +112 -0
- data/app/assets/javascripts/gridx/support/GotoPageButton.js +92 -0
- data/app/assets/javascripts/gridx/support/GotoPagePane.js +61 -0
- data/app/assets/javascripts/gridx/support/LinkPager.js +180 -0
- data/app/assets/javascripts/gridx/support/LinkSizer.js +138 -0
- data/app/assets/javascripts/gridx/support/QuickFilter.js +138 -0
- data/app/assets/javascripts/gridx/support/Summary.js +49 -0
- data/app/assets/javascripts/gridx/support/_LinkPageBase.js +92 -0
- data/app/assets/javascripts/gridx/support/exporter/exporter.js +350 -0
- data/app/assets/javascripts/gridx/support/exporter/toCSV.js +75 -0
- data/app/assets/javascripts/gridx/support/exporter/toTable.js +92 -0
- data/app/assets/javascripts/gridx/support/menu/AZFilterMenu.js +57 -0
- data/app/assets/javascripts/gridx/support/menu/NumberFilterMenu.js +87 -0
- data/app/assets/javascripts/gridx/support/menu/_FilterMenuBase.js +83 -0
- data/app/assets/javascripts/gridx/support/printer.js +157 -0
- data/app/assets/javascripts/gridx/templates/FilterBar.html +8 -0
- data/app/assets/javascripts/gridx/templates/FilterConfirmDialog.html +5 -0
- data/app/assets/javascripts/gridx/templates/FilterDialog.html +19 -0
- data/app/assets/javascripts/gridx/templates/FilterPane.html +64 -0
- data/app/assets/javascripts/gridx/templates/GotoPagePane.html +28 -0
- data/app/assets/javascripts/gridx/templates/Grid.html +19 -0
- data/app/assets/javascripts/gridx/templates/LinkPager.html +24 -0
- data/app/assets/javascripts/gridx/templates/PaginationBar.html +60 -0
- data/app/assets/javascripts/gridx/templates/PaginationBarDD.html +23 -0
- data/app/assets/javascripts/gridx/templates/QuickFilter.html +38 -0
- data/app/assets/stylesheets/gridx/mobile/themes/iphone/Grid.css +107 -0
- data/app/assets/stylesheets/gridx/resources/Dod.css +39 -0
- data/app/assets/stylesheets/gridx/resources/Gridx.css +10 -0
- data/app/assets/stylesheets/gridx/resources/Gridx_rtl.css +5 -0
- data/app/assets/stylesheets/gridx/resources/Tree.css +46 -0
- data/app/assets/stylesheets/gridx/resources/Tree_rtl.css +4 -0
- data/app/assets/stylesheets/gridx/resources/bar.css +24 -0
- data/app/assets/stylesheets/gridx/resources/basic.css +482 -0
- data/app/assets/stylesheets/gridx/resources/basic_rtl.css +37 -0
- data/app/assets/stylesheets/gridx/resources/claro/Gridx.css +16 -0
- data/app/assets/stylesheets/gridx/resources/claro/Gridx_rtl.css +7 -0
- data/app/assets/stylesheets/gridx/resources/claro/basic.css +109 -0
- data/app/assets/stylesheets/gridx/resources/claro/basic_rtl.css +21 -0
- data/app/assets/stylesheets/gridx/resources/claro/filter.css +47 -0
- data/app/assets/stylesheets/gridx/resources/claro/lock.css +19 -0
- data/app/assets/stylesheets/gridx/resources/claro/pagination.css +33 -0
- data/app/assets/stylesheets/gridx/resources/claro/select.css +20 -0
- data/app/assets/stylesheets/gridx/resources/dnd.css +108 -0
- data/app/assets/stylesheets/gridx/resources/filter.css +321 -0
- data/app/assets/stylesheets/gridx/resources/filter_rtl.css +38 -0
- data/app/assets/stylesheets/gridx/resources/lock.css +20 -0
- data/app/assets/stylesheets/gridx/resources/pagination.css +142 -0
- data/app/assets/stylesheets/gridx/resources/pagination_rtl.css +54 -0
- data/app/assets/stylesheets/gridx/resources/select.css +39 -0
- data/app/assets/stylesheets/gridx/resources/sort.css +154 -0
- data/app/assets/stylesheets/gridx/resources/sort_rtl.css +51 -0
- data/lib/gridx-rails/engine.rb +8 -0
- data/lib/gridx-rails/version.rb +3 -0
- data/lib/gridx-rails.rb +4 -0
- data/lib/tasks/gridx-rails_tasks.rake +52 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +78 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/gridx-rails_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +621 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
define([
|
|
2
|
+
'dojo/_base/declare',
|
|
3
|
+
'dojo/_base/lang',
|
|
4
|
+
'dojo/_base/array',
|
|
5
|
+
'dojo/dom-class',
|
|
6
|
+
'dojo/keys',
|
|
7
|
+
'dijit/_WidgetBase',
|
|
8
|
+
'dijit/_TemplatedMixin',
|
|
9
|
+
'dijit/_WidgetsInTemplateMixin',
|
|
10
|
+
'dijit/form/TextBox',
|
|
11
|
+
'dijit/form/Button',
|
|
12
|
+
'dijit/form/ComboButton',
|
|
13
|
+
'dijit/Menu',
|
|
14
|
+
'dijit/MenuItem',
|
|
15
|
+
'../modules/Filter',
|
|
16
|
+
'dojo/i18n',
|
|
17
|
+
'dojo/text!../templates/QuickFilter.html',
|
|
18
|
+
'dojo/i18n!../nls/QuickFilter'
|
|
19
|
+
], function(declare, lang, array, domClass, keys,
|
|
20
|
+
_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin,
|
|
21
|
+
TextBox, Button, ComboButton, Menu, MenuItem,
|
|
22
|
+
F, i18n, template){
|
|
23
|
+
|
|
24
|
+
/*=====
|
|
25
|
+
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
|
|
26
|
+
// summary:
|
|
27
|
+
// Quick filter box.
|
|
28
|
+
|
|
29
|
+
// grid: [const] gridx.Grid
|
|
30
|
+
// The grid widget this plugin works for.
|
|
31
|
+
grid: null,
|
|
32
|
+
|
|
33
|
+
// autoApply: Boolean
|
|
34
|
+
// If true, the filter will be applied to grid during typing in the filter box.
|
|
35
|
+
autoApply: true,
|
|
36
|
+
|
|
37
|
+
// delay: Integer
|
|
38
|
+
// The time (in ms) delay before applying the filter after each key stroke in the filter box.
|
|
39
|
+
// Only effective when autoApply is true,
|
|
40
|
+
delay: 700
|
|
41
|
+
});
|
|
42
|
+
=====*/
|
|
43
|
+
|
|
44
|
+
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
|
|
45
|
+
templateString: template,
|
|
46
|
+
|
|
47
|
+
constructor: function(args){
|
|
48
|
+
lang.mixin(this, i18n.getLocalization('gridx', 'QuickFilter', args.grid.lang));
|
|
49
|
+
this._hasFilterBar = args.grid.filterBar ? 'gridxQuickFilterHasFilterBar' : 'gridxQuickFilterNoFilterBar';
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
postCreate: function(){
|
|
53
|
+
if(this.autoApply){
|
|
54
|
+
this.connect(this.textBox, 'onInput', '_onInput');
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
grid: null,
|
|
59
|
+
|
|
60
|
+
textBoxClass: 'dijit.form.TextBox',
|
|
61
|
+
|
|
62
|
+
buttonClass: 'dijit.form.Button',
|
|
63
|
+
|
|
64
|
+
comboButtonClass: 'dijit.form.ComboButton',
|
|
65
|
+
|
|
66
|
+
menuClass: 'dijit.Menu',
|
|
67
|
+
|
|
68
|
+
menuItemClass: 'dijit.MenuItem',
|
|
69
|
+
|
|
70
|
+
autoApply: true,
|
|
71
|
+
|
|
72
|
+
delay: 700,
|
|
73
|
+
|
|
74
|
+
//Private--------------------------------------------------------------------
|
|
75
|
+
_onInput: function(evt){
|
|
76
|
+
var t = this,
|
|
77
|
+
dn = t.domNode,
|
|
78
|
+
tb = t.textBox,
|
|
79
|
+
key = evt.keyCode;
|
|
80
|
+
setTimeout(function(){
|
|
81
|
+
domClass.toggle(dn, 'gridxQuickFilterActive', tb.get('value'));
|
|
82
|
+
}, 0);
|
|
83
|
+
if(key != keys.TAB){
|
|
84
|
+
clearTimeout(t._handle);
|
|
85
|
+
t._handle = setTimeout(function(){
|
|
86
|
+
t._filter();
|
|
87
|
+
}, key == keys.ENTER ? 0 : t.delay);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
_onKey: function(evt){
|
|
92
|
+
if(evt.keyCode == keys.ENTER){
|
|
93
|
+
this.grid.focus.stopEvent(evt);
|
|
94
|
+
this._clear();
|
|
95
|
+
this.textBox.focus();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
_clear: function(){
|
|
100
|
+
this.textBox.set('value', '');
|
|
101
|
+
domClass.remove(this.domNode, 'gridxQuickFilterActive');
|
|
102
|
+
this._filter();
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
_filter: function(){
|
|
106
|
+
var t = this,
|
|
107
|
+
g = t.grid,
|
|
108
|
+
v = t.textBox.get('value'),
|
|
109
|
+
cols = array.filter(g.columns(), function(col){
|
|
110
|
+
return col.filterable !== false;
|
|
111
|
+
});
|
|
112
|
+
clearTimeout(t._handle);
|
|
113
|
+
if(g.filterBar){
|
|
114
|
+
//TODO: is there a better way communicate with FilterBar?
|
|
115
|
+
if(v === ''){
|
|
116
|
+
g.filterBar.clearFilter(true);
|
|
117
|
+
}else{
|
|
118
|
+
g.filterBar.applyFilter({
|
|
119
|
+
conditions: [{
|
|
120
|
+
condition: 'contain',
|
|
121
|
+
value: v
|
|
122
|
+
}]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}else{
|
|
126
|
+
g.filter.setFilter(v === '' ? 0 : F.or.apply(0, array.map(cols, function(col){
|
|
127
|
+
return F.contain(F.column(col.id), F.value(v));
|
|
128
|
+
})));
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
_showFilterBar: function(){
|
|
133
|
+
var fb = this.grid.filterBar;
|
|
134
|
+
fb.show();
|
|
135
|
+
fb.showFilterDialog();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
define([
|
|
2
|
+
"dojo/_base/declare",
|
|
3
|
+
"dojo/string",
|
|
4
|
+
"dijit/_WidgetBase",
|
|
5
|
+
"dijit/_TemplatedMixin",
|
|
6
|
+
"dojo/i18n",
|
|
7
|
+
"dojo/i18n!../nls/SummaryBar"
|
|
8
|
+
], function(declare, string, _WidgetBase, _TemplatedMixin, i18n){
|
|
9
|
+
|
|
10
|
+
/*=====
|
|
11
|
+
return declare([_WidgetBase, _TemplatedMixin], {
|
|
12
|
+
// summary:
|
|
13
|
+
// Show total row count and selected row count.
|
|
14
|
+
|
|
15
|
+
// gridx: [const] gridx/Grid
|
|
16
|
+
grid: null,
|
|
17
|
+
|
|
18
|
+
refresh: function(){
|
|
19
|
+
// summary:
|
|
20
|
+
// Update the summary text.
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
=====*/
|
|
24
|
+
|
|
25
|
+
return declare([_WidgetBase, _TemplatedMixin], {
|
|
26
|
+
templateString: '<div class="gridxSummary"></div>',
|
|
27
|
+
|
|
28
|
+
grid: null,
|
|
29
|
+
|
|
30
|
+
postCreate: function(){
|
|
31
|
+
var t = this,
|
|
32
|
+
c = 'connect',
|
|
33
|
+
m = t.grid.model;
|
|
34
|
+
t[c](m, 'onSizeChange', 'refresh');
|
|
35
|
+
t[c](m, 'onMarkChange', 'refresh');
|
|
36
|
+
t._nls = i18n.getLocalization('gridx', 'SummaryBar', t.lang || t.grid.lang);
|
|
37
|
+
t.refresh();
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
refresh: function(){
|
|
41
|
+
var g = this.grid,
|
|
42
|
+
sr = g.select && g.select.row,
|
|
43
|
+
size = g.model.size(),
|
|
44
|
+
selected = sr ? sr.getSelected().length : 0,
|
|
45
|
+
tpl = sr ? this._nls.summaryWithSelection : this._nls.summary;
|
|
46
|
+
this.domNode.innerHTML = string.substitute(tpl, [size, selected]);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
define([
|
|
2
|
+
"dojo/_base/declare",
|
|
3
|
+
"dojo/_base/lang",
|
|
4
|
+
"dojo/_base/array",
|
|
5
|
+
"dojo/_base/sniff",
|
|
6
|
+
"dojo/dom-class",
|
|
7
|
+
"dijit/_WidgetBase",
|
|
8
|
+
"dijit/_FocusMixin",
|
|
9
|
+
"dijit/_TemplatedMixin",
|
|
10
|
+
"dojo/i18n",
|
|
11
|
+
"dojo/i18n!../nls/PaginationBar"
|
|
12
|
+
], function(declare, lang, array, has, domClass, _WidgetBase, _FocusMixin, _TemplatedMixin, i18n){
|
|
13
|
+
|
|
14
|
+
/*=====
|
|
15
|
+
return declare([_WidgetBase, _TemplatedMixin, _FocusMixin], {
|
|
16
|
+
|
|
17
|
+
// grid: [const] gridx.Grid
|
|
18
|
+
// The grid widget this plugin works for.
|
|
19
|
+
grid: null
|
|
20
|
+
});
|
|
21
|
+
=====*/
|
|
22
|
+
|
|
23
|
+
return declare([_WidgetBase, _TemplatedMixin, _FocusMixin], {
|
|
24
|
+
constructor: function(args){
|
|
25
|
+
var t = this;
|
|
26
|
+
lang.mixin(t, i18n.getLocalization('gridx', 'PaginationBar'));
|
|
27
|
+
if(has('ie')){
|
|
28
|
+
//IE does not support inline-block, so have to set tabIndex
|
|
29
|
+
var gridTabIndex = args.grid.domNode.getAttribute('tabindex');
|
|
30
|
+
t._tabIndex = gridTabIndex > 0 ? gridTabIndex : 0;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
postCreate: function(){
|
|
35
|
+
var t = this;
|
|
36
|
+
t.domNode.setAttribute('tabIndex', t.grid.domNode.getAttribute('tabIndex'));
|
|
37
|
+
t.connect(t, 'onFocus', '_onFocus');
|
|
38
|
+
t.connect(t.domNode, 'onkeydown', '_onKey');
|
|
39
|
+
t.grid.pagination.loaded.then(function(){
|
|
40
|
+
t.refresh();
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
//Public-----------------------------------------------------------------------------
|
|
45
|
+
grid: null,
|
|
46
|
+
|
|
47
|
+
//Private----------------------------------------------------------------------------
|
|
48
|
+
_tabIndex: -1,
|
|
49
|
+
|
|
50
|
+
_findNodeByEvent: function(evt, targetClass, containerClass){
|
|
51
|
+
var n = evt.target,
|
|
52
|
+
hasClass = domClass.contains;
|
|
53
|
+
while(!hasClass(n, targetClass)){
|
|
54
|
+
if(hasClass(n, containerClass)){
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
n = n.parentNode;
|
|
58
|
+
}
|
|
59
|
+
return n;
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
_toggleHover: function(evt, targetCls, containerCls, hoverCls){
|
|
63
|
+
var n = this._findNodeByEvent(evt, targetCls, containerCls);
|
|
64
|
+
if(n){
|
|
65
|
+
domClass.toggle(n, hoverCls, evt.type == 'mouseover');
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
_focus: function(nodes, node, isMove, isLeft, isFocusable){
|
|
70
|
+
//Try to focus on node, but if node is not focsable, find the next focusable node in nodes
|
|
71
|
+
//along the given direction. If not found, try the other direction.
|
|
72
|
+
//Return the node if successfully focused, null if not.
|
|
73
|
+
var dir = isLeft ? -1 : 1,
|
|
74
|
+
i = node ? array.indexOf(nodes, node) + (isMove ? dir : 0) : (isLeft ? nodes.length - 1 : 0),
|
|
75
|
+
findNode = function(i, dir){
|
|
76
|
+
while(nodes[i] && !isFocusable(nodes[i])){
|
|
77
|
+
i += dir;
|
|
78
|
+
}
|
|
79
|
+
return nodes[i];
|
|
80
|
+
};
|
|
81
|
+
node = findNode(i, dir) || findNode(i - dir, -dir);
|
|
82
|
+
if(node){
|
|
83
|
+
node.focus();
|
|
84
|
+
}
|
|
85
|
+
return node;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
_onFocus: function(){
|
|
89
|
+
this._focusNextBtn();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
define([
|
|
2
|
+
/*====="dojo/_base/declare", =====*/
|
|
3
|
+
"dojo/_base/lang",
|
|
4
|
+
"dojo/_base/Deferred",
|
|
5
|
+
"dojo/_base/array"
|
|
6
|
+
], function(/*=====declare, =====*/lang, Deferred, array){
|
|
7
|
+
|
|
8
|
+
/*=====
|
|
9
|
+
function exporter(grid, writer, args){
|
|
10
|
+
// summary:
|
|
11
|
+
// Go through the grid using the given args and writer implementation.
|
|
12
|
+
// Return a dojo.Deferred object. Users can cancel and see progress
|
|
13
|
+
// of the exporting process.
|
|
14
|
+
// Pass the exported result to the callback function of the Deferred object.
|
|
15
|
+
// grid: gridx/Grid
|
|
16
|
+
// The grid instance to export
|
|
17
|
+
// writer: __Writer
|
|
18
|
+
// The writer implementation.
|
|
19
|
+
// args: __ExportArgs
|
|
20
|
+
// Export arguments.
|
|
21
|
+
// returns:
|
|
22
|
+
// A deferred object.
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exporter.__Writer = declare([], {
|
|
26
|
+
beforeHeader: function(args, context){
|
|
27
|
+
//summary:
|
|
28
|
+
// Triggered before exporting the header cells.
|
|
29
|
+
//return: Boolean|undefined
|
|
30
|
+
// If return false, does not handle following header cells.
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
handleHeaderCell: function(args, context){
|
|
34
|
+
//summary:
|
|
35
|
+
// Triggered when exporting a header cell.
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
afterHeader: function(args, context){
|
|
39
|
+
//summary:
|
|
40
|
+
// Triggered when the header has been exported.
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
beforeBody: function(args, context){
|
|
44
|
+
//summary:
|
|
45
|
+
// Triggered before exporting the grid body.
|
|
46
|
+
//return: Boolean|undefined
|
|
47
|
+
// If return false, does not handle any of the grid body content.
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
beforeRow: function(args, context){
|
|
51
|
+
//summary:
|
|
52
|
+
// Triggered before exporting a row.
|
|
53
|
+
//return: Boolean|undefined
|
|
54
|
+
// If return false, does not handle the cells in this row.
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
handleCell: function(args, context){
|
|
58
|
+
//summary:
|
|
59
|
+
// Triggered when exporting a cell.
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
afterRow: function(args, context){
|
|
63
|
+
//summary:
|
|
64
|
+
// Triggered when a row has been exported.
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
afterBody: function(args, context){
|
|
68
|
+
//summary:
|
|
69
|
+
// Triggered when the grid body has been exported.
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
getResult: function(){
|
|
73
|
+
//summary:
|
|
74
|
+
// This must be implemented.
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
exporter.__ExportArgs = declare([], {
|
|
80
|
+
// columns: String[]?
|
|
81
|
+
// An array of column ID. Indicates which columns to be exported.
|
|
82
|
+
// If invalid or empty array, export all grid columns.
|
|
83
|
+
columns: null,
|
|
84
|
+
|
|
85
|
+
// start: Number?
|
|
86
|
+
// Indicates from which row to start exporting. If invalid,
|
|
87
|
+
// default to 0.
|
|
88
|
+
start: 0,
|
|
89
|
+
|
|
90
|
+
// count: Number?
|
|
91
|
+
// Indicates the count of rows export.
|
|
92
|
+
// If invalid, export all rows up to the end of grid.
|
|
93
|
+
count: 0,
|
|
94
|
+
|
|
95
|
+
// selectedOnly: Boolean?
|
|
96
|
+
// Whether only export selected rows. This constraint is applied
|
|
97
|
+
// upon the rows specified by start and count parameters.
|
|
98
|
+
// This paramter and the filter parameter can be used togetther.
|
|
99
|
+
// Default to false.
|
|
100
|
+
selectedOnly: false,
|
|
101
|
+
|
|
102
|
+
// filter: Function?
|
|
103
|
+
// A predicate function (returns Boolean) to judge whether to
|
|
104
|
+
// export a row.
|
|
105
|
+
// This constraint is applied upon the result rows of the
|
|
106
|
+
// selectedOnly parameter, if provided.
|
|
107
|
+
filter: null,
|
|
108
|
+
|
|
109
|
+
// useStoreData: Boolean?
|
|
110
|
+
// Indicates whether to export grid data (formatted data) or
|
|
111
|
+
// store data. Default to false.
|
|
112
|
+
useStoreData: false,
|
|
113
|
+
|
|
114
|
+
// formatters: Object?
|
|
115
|
+
// A customized way to export data, if neither grid data nor store
|
|
116
|
+
// data could meet the requirement.
|
|
117
|
+
// This is an associative array from column id to formatter function.
|
|
118
|
+
// A grid cell object will be passed into that function as an argument.
|
|
119
|
+
formatter: null,
|
|
120
|
+
|
|
121
|
+
// omitHeader: Boolean?
|
|
122
|
+
// Indicates whether to export grid header. Default to false.
|
|
123
|
+
omitHeader: false,
|
|
124
|
+
|
|
125
|
+
// progressStep: Number?
|
|
126
|
+
// Number of rows in each progress. Default to 0 (invalid means only one progress).
|
|
127
|
+
// After each progress, the deferred.progress() is called, so the
|
|
128
|
+
// exporting process can be viewed by the user.
|
|
129
|
+
progressStep: 0
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
exporter.__ExportContext = {
|
|
133
|
+
// columnIds: String[]
|
|
134
|
+
// Available for header.
|
|
135
|
+
columnIds: null,
|
|
136
|
+
|
|
137
|
+
// column: Grid Column
|
|
138
|
+
// Available for header cell or a body cell.
|
|
139
|
+
column: null,
|
|
140
|
+
|
|
141
|
+
// row: Grid Row
|
|
142
|
+
// Available for a row or a body cell.
|
|
143
|
+
row: null,
|
|
144
|
+
|
|
145
|
+
// cell: Grid Cell
|
|
146
|
+
// Available for a body cell
|
|
147
|
+
cell: null,
|
|
148
|
+
|
|
149
|
+
// data: Anything
|
|
150
|
+
// Available for a body cell
|
|
151
|
+
data: null
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return exporter;
|
|
155
|
+
=====*/
|
|
156
|
+
|
|
157
|
+
function check(writer, method, context, args){
|
|
158
|
+
return !writer[method] || false !== writer[method](context || args, args);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function prepareReqs(args, rowIndexes, size){
|
|
162
|
+
var reqs = [],
|
|
163
|
+
i, start = 0, end = 0,
|
|
164
|
+
ps = args.progressStep;
|
|
165
|
+
if(typeof args.start == 'number' && args.start >= 0){
|
|
166
|
+
start = args.start;
|
|
167
|
+
}
|
|
168
|
+
if(typeof args.count == 'number' && args.count > 0){
|
|
169
|
+
end = start + args.count;
|
|
170
|
+
}
|
|
171
|
+
end = end || size;
|
|
172
|
+
if(rowIndexes){
|
|
173
|
+
rowIndexes = array.filter(rowIndexes, function(idx){
|
|
174
|
+
return idx >= start && idx < end;
|
|
175
|
+
});
|
|
176
|
+
if(rowIndexes.length && (!ps || rowIndexes.length <= ps)){
|
|
177
|
+
reqs.push(rowIndexes);
|
|
178
|
+
}else{
|
|
179
|
+
for(i = 0; i < rowIndexes.length; i += ps){
|
|
180
|
+
reqs.push(rowIndexes.slice(i, i + ps));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}else{
|
|
184
|
+
var count = end - start;
|
|
185
|
+
if(!ps || count <= ps){
|
|
186
|
+
reqs.push({
|
|
187
|
+
start: start,
|
|
188
|
+
count: count
|
|
189
|
+
});
|
|
190
|
+
}else{
|
|
191
|
+
for(i = start; i < end; i += ps){
|
|
192
|
+
reqs.push({
|
|
193
|
+
start: i,
|
|
194
|
+
count: i + ps < end ? ps : end - i
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
reqs.p = 0;
|
|
200
|
+
return reqs;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function first(req, grid){
|
|
204
|
+
return lang.isArray(req) ? {
|
|
205
|
+
p: 0,
|
|
206
|
+
row: grid.row(req[0])
|
|
207
|
+
} : {
|
|
208
|
+
p: req.start,
|
|
209
|
+
row: grid.row(req.start)
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function next(req, grid, prevRow){
|
|
214
|
+
var p = prevRow.p + 1,
|
|
215
|
+
isArray = lang.isArray(req);
|
|
216
|
+
return p < (isArray ? req.length : req.start + req.count) ? {
|
|
217
|
+
p: p,
|
|
218
|
+
row: grid.row(isArray ? req[p] : p)
|
|
219
|
+
} : null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function format(args, cell){
|
|
223
|
+
var fs = args.formatters,
|
|
224
|
+
cid = cell.column.id;
|
|
225
|
+
if(fs && lang.isFunction(fs[cid])){
|
|
226
|
+
return fs[cid](cell);
|
|
227
|
+
}else if(args.useStoreData){
|
|
228
|
+
return cell.rawData() || '';
|
|
229
|
+
}
|
|
230
|
+
return cell.data() || '';
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function fetchRows(grid, defer, writer, context, args, d, reqs){
|
|
234
|
+
var f = args.filter,
|
|
235
|
+
cols = context.columnIds,
|
|
236
|
+
req = reqs[reqs.p++],
|
|
237
|
+
fail = lang.hitch(d, d.errback),
|
|
238
|
+
func = function(){
|
|
239
|
+
defer.progress(reqs.p / reqs.length);
|
|
240
|
+
grid.when(req, function(){
|
|
241
|
+
for(var r = first(req, grid); r && r.row; r = next(req, grid, r)){
|
|
242
|
+
context.row = r.row;
|
|
243
|
+
if((!f || f(r.row)) && check(writer, 'beforeRow', context, args)){
|
|
244
|
+
for(var i = 0; i < cols.length; ++i){
|
|
245
|
+
var col = grid.column(cols[i], 1), //1 as true
|
|
246
|
+
cell = context.cell = grid.cell(r.row, col);
|
|
247
|
+
context.column = col;
|
|
248
|
+
context.data = format(args, cell);
|
|
249
|
+
check(writer, 'handleCell', context, args);
|
|
250
|
+
}
|
|
251
|
+
check(writer, 'afterRow', context, args);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}).then(function(){
|
|
255
|
+
fetchRows(grid, defer, writer, context, args, d, reqs);
|
|
256
|
+
}, fail);
|
|
257
|
+
};
|
|
258
|
+
if(req){
|
|
259
|
+
if(reqs.length > 1){
|
|
260
|
+
setTimeout(func, 10);
|
|
261
|
+
}else{
|
|
262
|
+
func();
|
|
263
|
+
}
|
|
264
|
+
}else{
|
|
265
|
+
d.callback();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function getColumns(grid, args){
|
|
270
|
+
var colsById = grid._columnsById,
|
|
271
|
+
s = grid.select,
|
|
272
|
+
sc = s && s.column,
|
|
273
|
+
cols;
|
|
274
|
+
if(lang.isArrayLike(args.columns) && args.columns.length){
|
|
275
|
+
cols = array.filter(args.columns, function(cid){
|
|
276
|
+
return colsById[cid];
|
|
277
|
+
});
|
|
278
|
+
cols.sort(function(a, b){
|
|
279
|
+
return colsById[a].index - colsById[b].index;
|
|
280
|
+
});
|
|
281
|
+
}else{
|
|
282
|
+
cols = array.map(grid._columns, function(c){
|
|
283
|
+
return c.id;
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
return cols;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function exporter(grid, writer, /* __ExportArgs */ args){
|
|
290
|
+
var d = new Deferred(),
|
|
291
|
+
model = grid.model,
|
|
292
|
+
cols = getColumns(grid, args),
|
|
293
|
+
s = grid.select,
|
|
294
|
+
sr = s && s.row,
|
|
295
|
+
sc = s && s.column,
|
|
296
|
+
waitForRows,
|
|
297
|
+
rowIds,
|
|
298
|
+
context = {
|
|
299
|
+
grid: grid,
|
|
300
|
+
columnIds: cols
|
|
301
|
+
},
|
|
302
|
+
success = function(){
|
|
303
|
+
check(writer, 'afterBody', context, args);
|
|
304
|
+
d.callback(writer.getResult());
|
|
305
|
+
},
|
|
306
|
+
fail = lang.hitch(d, d.errback);
|
|
307
|
+
|
|
308
|
+
try{
|
|
309
|
+
check(writer, 'initialize', context, args);
|
|
310
|
+
if(!args.omitHeader && check(writer, 'beforeHeader', context, args)){
|
|
311
|
+
array.forEach(cols, function(cid){
|
|
312
|
+
context.column = grid.column(cid, 1); //1 as true
|
|
313
|
+
check(writer, 'handleHeaderCell', context, args);
|
|
314
|
+
});
|
|
315
|
+
check(writer, 'afterHeader', context, args);
|
|
316
|
+
}
|
|
317
|
+
if(check(writer, 'beforeBody', context, args)){
|
|
318
|
+
if(args.selectedOnly && sr && (!sc || !sc.getSelected().length)){
|
|
319
|
+
waitForRows = model.when().then(function(){
|
|
320
|
+
rowIds = sr.getSelected();
|
|
321
|
+
}, fail);
|
|
322
|
+
}
|
|
323
|
+
Deferred.when(waitForRows, function(){
|
|
324
|
+
var rowIdxes,
|
|
325
|
+
waitForRowIndex = rowIds && model.when({id: rowIds}, function(){
|
|
326
|
+
rowIdxes = array.map(rowIds, function(id){
|
|
327
|
+
return model.idToIndex(id);
|
|
328
|
+
});
|
|
329
|
+
rowIdxes.sort(function(a, b){
|
|
330
|
+
return a - b;
|
|
331
|
+
});
|
|
332
|
+
}, fail);
|
|
333
|
+
Deferred.when(waitForRowIndex, function(){
|
|
334
|
+
var dd = new Deferred(),
|
|
335
|
+
rowCount = model.size();
|
|
336
|
+
fetchRows(grid, d, writer, context, args, dd, prepareReqs(args, rowIdxes, rowCount));
|
|
337
|
+
dd.then(success, fail);
|
|
338
|
+
}, fail);
|
|
339
|
+
}, fail);
|
|
340
|
+
}else{
|
|
341
|
+
d.callback(writer.getResult());
|
|
342
|
+
}
|
|
343
|
+
}catch(e){
|
|
344
|
+
fail(e);
|
|
345
|
+
}
|
|
346
|
+
return d;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return exporter;
|
|
350
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
define([
|
|
2
|
+
/*====="dojo/_base/declare", =====*/
|
|
3
|
+
"./exporter"
|
|
4
|
+
], function(/*=====declare, =====*/exporter){
|
|
5
|
+
|
|
6
|
+
/*=====
|
|
7
|
+
function toCSV(grid, args){
|
|
8
|
+
// summary:
|
|
9
|
+
// Export the grid contents to CSV according to the given args.
|
|
10
|
+
// args: __CSVExportArgs?
|
|
11
|
+
// The args to configure the export result and the export process.
|
|
12
|
+
// returns:
|
|
13
|
+
// A deferred object indicating when the export process is completed,
|
|
14
|
+
// and then pass the exported CSV string to callbacks.
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
toCSV.__CSVExportArgs = declare(exporter.__ExportArgs, {
|
|
18
|
+
// seperator: String?
|
|
19
|
+
// The seperator string used in CSV. Default to comma ','.
|
|
20
|
+
separator: '',
|
|
21
|
+
|
|
22
|
+
// newLine: String?
|
|
23
|
+
// The new line string used in CSV. Deault to '\r\n';
|
|
24
|
+
newLine: ''
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return toCSV;
|
|
28
|
+
=====*/
|
|
29
|
+
|
|
30
|
+
function toCSV(grid, args){
|
|
31
|
+
return exporter(grid, toCSV.writer, args || {});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
toCSV.writer = {
|
|
35
|
+
initialize: function(context, args){
|
|
36
|
+
this._s = args.separator || ",";
|
|
37
|
+
this._n = args.newLine || "\r\n";
|
|
38
|
+
this._lines = [];
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
beforeHeader: function(){
|
|
42
|
+
this._cells = [];
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
handleHeaderCell: function(context){
|
|
46
|
+
this._cells.push(context.column.name());
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
afterHeader: function(){
|
|
50
|
+
this._lines.push(this._cells.join(this._s));
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
beforeRow: function(){
|
|
54
|
+
this._cells = [];
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
handleCell: function(context){
|
|
58
|
+
var data = String(context.data).replace(/"/g, '""');
|
|
59
|
+
if(data.indexOf(this._s) >= 0 || data.search(/[" \t\r\n]/) >= 0){
|
|
60
|
+
data = '"' + data + '"';
|
|
61
|
+
}
|
|
62
|
+
this._cells.push(data);
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
afterRow: function(){
|
|
66
|
+
this._lines.push(this._cells.join(this._s));
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
getResult: function(){
|
|
70
|
+
return this._lines.join(this._n);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return toCSV;
|
|
75
|
+
});
|