From 411b8c02d2ed327e5035dc8cc01b7d77c426bfe5 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 14 Oct 2014 15:21:10 +0800 Subject: [PATCH 01/10] fix empty time value include in the filtered resultset --- modules/Filter.js | 24 ++++++++++++++++++------ modules/filter/FilterBar.js | 14 ++++++++------ tests/support/data/MusicData.js | 2 +- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/modules/Filter.js b/modules/Filter.js index a5c5f9fb2..168303a8b 100644 --- a/modules/Filter.js +++ b/modules/Filter.js @@ -357,10 +357,13 @@ define([ return d.getTime(); case 'time': d = new Date(d); - d.setDate(1); - d.setMonth(0); - d.setFullYear(2000); - return d.getTime(); + if(!isNaN(d.getTime())){ //d is not invalid date + d.setDate(1); + d.setMonth(0); + d.setFullYear(2000); + return d.getTime(); + } + return null; default: //string return (d === null || d === undefined) ? '' : String(d); } @@ -485,13 +488,22 @@ define([ greaterEqual: function(expr1, expr2){ return wrap(function(){ - return expr1.apply(0, arguments) >= expr2.apply(0, arguments); + var v1 = expr1.apply(0, arguments); + var v2 = expr2.apply(0, arguments); + return v1 !== undefined && v1 !== null && + v2 !== undefined && v2 !== null && + v1 >= v2; }, "greaterEqual", [expr1, expr2]); }, lessEqual: function(expr1, expr2){ return wrap(function(){ - return expr1.apply(0, arguments) <= expr2.apply(0, arguments); + var v1 = expr1.apply(0, arguments); + var v2 = expr2.apply(0, arguments); + console.log(v1, v2); + return v1 !== undefined && v1 !== null && + v2 !== undefined && v2 !== null && + v1 <= v2; }, "lessEqual", [expr1, expr2]); }, diff --git a/modules/filter/FilterBar.js b/modules/filter/FilterBar.js index fa6d6c5a8..987d2b4ea 100644 --- a/modules/filter/FilterBar.js +++ b/modules/filter/FilterBar.js @@ -661,12 +661,14 @@ define([ if(s instanceof Date){return s;} var pattern = /(\d\d?):(\d\d?):(\d\d?)/; - pattern.test(s); - var d = new Date(); - d.setHours(parseInt(RegExp.$1)); - d.setMinutes(parseInt(RegExp.$2)); - d.setSeconds(parseInt(RegExp.$3)); - return d; + if(pattern.test(s)){ + var d = new Date(); + d.setHours(parseInt(RegExp.$1)); + d.setMinutes(parseInt(RegExp.$2)); + d.setSeconds(parseInt(RegExp.$3)); + return d; + } + return 'invalid time'; }, _stringToDatetime: function(s){ if(s instanceof Date){return s;} diff --git a/tests/support/data/MusicData.js b/tests/support/data/MusicData.js index 904d51e47..70237f80a 100644 --- a/tests/support/data/MusicData.js +++ b/tests/support/data/MusicData.js @@ -28,7 +28,7 @@ define([ // {"Heard": '', "Progress": '', "Genre":"", "Artist":"", "Year": '', "Album":"", "Name":"", "Length":"", "Track": '', "Composer":"", "Download Date":"", "Last Played":""}, // {"Heard": '', "Progress": '', "Genre":"", "Artist":"", "Year": '', "Album":"", "Name":"", "Length":"", "Track": '', "Composer":"", "Download Date":"", "Last Played":""}, {"Heard": true, "Progress": 0.5, "Genre":"Easy Date: Wed, 15 Oct 2014 16:31:38 +0800 Subject: [PATCH 02/10] update filter test page to add empty data for dateTime column --- modules/Filter.js | 2 +- modules/filter/FilterPane.js | 5 ----- tests/support/data/MusicData.js | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/modules/Filter.js b/modules/Filter.js index 168303a8b..2f1e0e747 100644 --- a/modules/Filter.js +++ b/modules/Filter.js @@ -500,7 +500,7 @@ define([ return wrap(function(){ var v1 = expr1.apply(0, arguments); var v2 = expr2.apply(0, arguments); - console.log(v1, v2); + return v1 !== undefined && v1 !== null && v2 !== undefined && v2 !== null && v1 <= v2; diff --git a/modules/filter/FilterPane.js b/modules/filter/FilterPane.js index a1be46b99..7e52ca527 100644 --- a/modules/filter/FilterPane.js +++ b/modules/filter/FilterPane.js @@ -415,11 +415,6 @@ define([ }, _setValue: function(value){ - console.log('in set value'); - console.log(value); - console.log(typeof value); - console.log(value instanceof Date); - if(!this._isValidValue(value)){return;} var type = this._getType(), combo = this._needComboBox(), tempDate; diff --git a/tests/support/data/MusicData.js b/tests/support/data/MusicData.js index 70237f80a..8ef555ca1 100644 --- a/tests/support/data/MusicData.js +++ b/tests/support/data/MusicData.js @@ -213,7 +213,7 @@ define([ id: i, order: i + 1, Color: new Color([Math.sin(i) * 100, Math.cos(i) * 100, i * i]).toHex(), - datetime: item['Download Date'] + ' ' + (item['Last Played']).substr(0, item['Last Played'].length - 2) + '00' + datetime: item['Download Date'] && item['Last Played'] ? item['Download Date'] + ' ' + (item['Last Played']).substr(0, item['Last Played'].length - 2) + '00' : '' }, item)); } return data; From a1538ba6562ed3ba976b416a8bb474413d2a92e6 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Thu, 16 Oct 2014 09:46:26 +0800 Subject: [PATCH 03/10] add past x "hours" condition --- modules/filter/FilterPane.js | 6 ++++++ nls/gridx.js | 5 +++++ templates/FilterPane.html | 18 ++++++++++-------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/modules/filter/FilterPane.js b/modules/filter/FilterPane.js index 7e52ca527..9ac36feee 100644 --- a/modules/filter/FilterPane.js +++ b/modules/filter/FilterPane.js @@ -350,6 +350,9 @@ define([ interval = this.sltDateInterval.get('value'); switch(interval){ + case 'hour': + past.setHours(cur.getHours() - val); + break; case 'day': past.setDate(cur.getDate() - val); break; @@ -388,6 +391,9 @@ define([ interval = this.sltDatetimeInterval.get('value'); switch(interval){ + case 'hour': + past.setHours(cur.getHours() - val); + break; case 'day': past.setDate(cur.getDate() - val); break; diff --git a/nls/gridx.js b/nls/gridx.js index c20acdc32..19d6ba86c 100644 --- a/nls/gridx.js +++ b/nls/gridx.js @@ -10,6 +10,11 @@ define({root: loadPreviousLoading: "Loading...", //FilterBar + "day": "days", + "month": "months", + "year": "years", + "hour": "hours", + "clearFilterDialogTitle": "Clear Filter", "filterDefDialogTitle": "Filter", "defaultRuleTitle": "Rule", diff --git a/templates/FilterPane.html b/templates/FilterPane.html index de38e944a..628baffd9 100644 --- a/templates/FilterPane.html +++ b/templates/FilterPane.html @@ -37,14 +37,15 @@
  • - +
  • - - - + + + +
    @@ -65,14 +66,15 @@
  • - +
  • - - - + + + +
    From 757e80c63c13b65453f1e00acf7a49c4495f6e71 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Thu, 16 Oct 2014 17:11:16 +0800 Subject: [PATCH 04/10] fix … special char in nls --- nls/el/gridx.js | 2 +- nls/es/gridx.js | 2 +- nls/fi/gridx.js | 2 +- nls/fr/gridx.js | 2 +- nls/gridx.js | 2 +- nls/he/gridx.js | 2 +- nls/hr/gridx.js | 2 +- nls/hu/gridx.js | 2 +- nls/id/gridx.js | 2 +- nls/it/gridx.js | 2 +- nls/ja/gridx.js | 2 +- nls/kk/gridx.js | 2 +- nls/ko/gridx.js | 2 +- nls/nb/gridx.js | 2 +- nls/nl/gridx.js | 2 +- nls/pl/gridx.js | 2 +- nls/pt-pt/gridx.js | 2 +- nls/pt/gridx.js | 2 +- nls/ro/gridx.js | 2 +- nls/ru/gridx.js | 2 +- nls/sk/gridx.js | 2 +- nls/sl/gridx.js | 2 +- nls/sv/gridx.js | 2 +- nls/th/gridx.js | 2 +- nls/tr/gridx.js | 2 +- nls/zh/gridx.js | 2 +- tests/test_grid_filter.js | 24 ++++++++++++++++++++++-- 27 files changed, 48 insertions(+), 28 deletions(-) diff --git a/nls/el/gridx.js b/nls/el/gridx.js index b96c27381..024489bef 100644 --- a/nls/el/gridx.js +++ b/nls/el/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Φίλτρο', clearButtonTitle: 'Εκκαθάριση φίλτρου', - buildFilterMenuLabel: 'Δημιουργία φίλτρου…', + buildFilterMenuLabel: 'Δημιουργία φίλτρου...', apply: 'Εφαρμογή φίλτρου', //Sort diff --git a/nls/es/gridx.js b/nls/es/gridx.js index d284342fd..b15bf614c 100644 --- a/nls/es/gridx.js +++ b/nls/es/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filtrar', clearButtonTitle: 'Borrar filtro', - buildFilterMenuLabel: 'Crear filtro…', + buildFilterMenuLabel: 'Crear filtro...', apply: 'Aplicar filtro', //Sort diff --git a/nls/fi/gridx.js b/nls/fi/gridx.js index 2907e7b68..a23c4ed2e 100644 --- a/nls/fi/gridx.js +++ b/nls/fi/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Suodatin', clearButtonTitle: 'Tyhjennä suodatin', - buildFilterMenuLabel: 'Muodosta suodatin…', + buildFilterMenuLabel: 'Muodosta suodatin...', apply: 'Käytä suodatinta', //Sort diff --git a/nls/fr/gridx.js b/nls/fr/gridx.js index 6cb3145ca..9032c51b6 100644 --- a/nls/fr/gridx.js +++ b/nls/fr/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filtre', clearButtonTitle: 'Effacer le filtre', - buildFilterMenuLabel: 'Générer le filtre…', + buildFilterMenuLabel: 'Générer le filtre...', apply: 'Appliquer le filtre', //Sort diff --git a/nls/gridx.js b/nls/gridx.js index 19d6ba86c..811b349bf 100644 --- a/nls/gridx.js +++ b/nls/gridx.js @@ -173,7 +173,7 @@ define({root: //QuickFilter filterLabel: 'Filter', clearButtonTitle: 'Clear Filter', - buildFilterMenuLabel: 'Build Filter…', + buildFilterMenuLabel: 'Build Filter...', apply: 'Apply Filter', //Sort diff --git a/nls/he/gridx.js b/nls/he/gridx.js index 47cf9d742..bf5cb16c3 100644 --- a/nls/he/gridx.js +++ b/nls/he/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'סינון', clearButtonTitle: 'ניקוי מסנן', - buildFilterMenuLabel: 'בניית מסנן…‏', + buildFilterMenuLabel: 'בניית מסנן...‏', apply: 'החלת מסנן', //Sort diff --git a/nls/hr/gridx.js b/nls/hr/gridx.js index d426d22d2..bb0f16967 100644 --- a/nls/hr/gridx.js +++ b/nls/hr/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filter', clearButtonTitle: 'Isprazni filter', - buildFilterMenuLabel: 'Kreiraj filter…', + buildFilterMenuLabel: 'Kreiraj filter...', apply: 'Primijeni filter', //Sort diff --git a/nls/hu/gridx.js b/nls/hu/gridx.js index 79153397e..4a6fde65b 100644 --- a/nls/hu/gridx.js +++ b/nls/hu/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Szűrő', clearButtonTitle: 'Szűrő törlése', - buildFilterMenuLabel: '… összeépítés-szűrő', + buildFilterMenuLabel: '... összeépítés-szűrő', apply: 'Szűrő alkalmazása', //Sort diff --git a/nls/id/gridx.js b/nls/id/gridx.js index 3c539e168..d7187e8ff 100644 --- a/nls/id/gridx.js +++ b/nls/id/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filter', clearButtonTitle: 'Hapus Filter', - buildFilterMenuLabel: 'Buat Filter…', + buildFilterMenuLabel: 'Buat Filter...', apply: 'Terapkan Filter', //Sort diff --git a/nls/it/gridx.js b/nls/it/gridx.js index d72724377..668866806 100644 --- a/nls/it/gridx.js +++ b/nls/it/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filtra', clearButtonTitle: 'Cancella filtro', - buildFilterMenuLabel: 'Crea filtro…', + buildFilterMenuLabel: 'Crea filtro...', apply: 'Applica filtro', //Sort diff --git a/nls/ja/gridx.js b/nls/ja/gridx.js index b25f4f5e2..cf5f19f66 100644 --- a/nls/ja/gridx.js +++ b/nls/ja/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'フィルター', clearButtonTitle: 'フィルターのクリア', - buildFilterMenuLabel: 'フィルターの作成…', + buildFilterMenuLabel: 'フィルターの作成...', apply: 'フィルターの適用', //Sort diff --git a/nls/kk/gridx.js b/nls/kk/gridx.js index ac394ae94..7b8e7b484 100644 --- a/nls/kk/gridx.js +++ b/nls/kk/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Сүзгі', clearButtonTitle: 'Сүзгіні тазалау', - buildFilterMenuLabel: 'Build Filter…', + buildFilterMenuLabel: 'Build Filter...', apply: 'Сүзгіні қолдану', //Sort diff --git a/nls/ko/gridx.js b/nls/ko/gridx.js index 991026c3d..f2b5d66ef 100644 --- a/nls/ko/gridx.js +++ b/nls/ko/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: '필터', clearButtonTitle: '필터 지우기', - buildFilterMenuLabel: '필터 빌드…', + buildFilterMenuLabel: '필터 빌드...', apply: '필터 적용', //Sort diff --git a/nls/nb/gridx.js b/nls/nb/gridx.js index e438fc8c0..926246be7 100644 --- a/nls/nb/gridx.js +++ b/nls/nb/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filtrer', clearButtonTitle: 'Tøm filter', - buildFilterMenuLabel: 'Bygg filter…', + buildFilterMenuLabel: 'Bygg filter...', apply: 'Bruk filter', //Sort diff --git a/nls/nl/gridx.js b/nls/nl/gridx.js index 74794f05e..e1bb18320 100644 --- a/nls/nl/gridx.js +++ b/nls/nl/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filter', clearButtonTitle: 'Filter verwijderen', - buildFilterMenuLabel: 'Filter bouwen…', + buildFilterMenuLabel: 'Filter bouwen...', apply: 'Filter toepassen', //Sort diff --git a/nls/pl/gridx.js b/nls/pl/gridx.js index 2634faca4..c4253c439 100644 --- a/nls/pl/gridx.js +++ b/nls/pl/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filtr', clearButtonTitle: 'Wyczyść filtr', - buildFilterMenuLabel: 'Zbuduj filtr…', + buildFilterMenuLabel: 'Zbuduj filtr...', apply: 'Zastosuj filtr', //Sort diff --git a/nls/pt-pt/gridx.js b/nls/pt-pt/gridx.js index 0e5f7a2a9..971cad3bf 100644 --- a/nls/pt-pt/gridx.js +++ b/nls/pt-pt/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filtro', clearButtonTitle: 'Limpar filtro', - buildFilterMenuLabel: 'Compilar Filtro…', + buildFilterMenuLabel: 'Compilar Filtro...', apply: 'Aplicar filtro', //Sort diff --git a/nls/pt/gridx.js b/nls/pt/gridx.js index 0b14dd26e..fd6e1511a 100644 --- a/nls/pt/gridx.js +++ b/nls/pt/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filtro', clearButtonTitle: 'Limpar Filtro', - buildFilterMenuLabel: 'Construir Filtro…', + buildFilterMenuLabel: 'Construir Filtro...', apply: 'Aplicar Filtro', //Sort diff --git a/nls/ro/gridx.js b/nls/ro/gridx.js index 01fb0646a..70fb16aa1 100644 --- a/nls/ro/gridx.js +++ b/nls/ro/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filtru', clearButtonTitle: 'Curăţare filtru', - buildFilterMenuLabel: 'Construire filtru…', + buildFilterMenuLabel: 'Construire filtru...', apply: 'Aplicare filtru', //Sort diff --git a/nls/ru/gridx.js b/nls/ru/gridx.js index 438fe4b2a..4716909a2 100644 --- a/nls/ru/gridx.js +++ b/nls/ru/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Фильтр', clearButtonTitle: 'Очистить фильтр', - buildFilterMenuLabel: 'Собрать фильтр…', + buildFilterMenuLabel: 'Собрать фильтр...', apply: 'Применить фильтр', //Sort diff --git a/nls/sk/gridx.js b/nls/sk/gridx.js index 0653613b7..5640d351c 100644 --- a/nls/sk/gridx.js +++ b/nls/sk/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filter', clearButtonTitle: 'Vymazať filter', - buildFilterMenuLabel: 'Vytvoriť filter…', + buildFilterMenuLabel: 'Vytvoriť filter...', apply: 'Použiť filter', //Sort diff --git a/nls/sl/gridx.js b/nls/sl/gridx.js index 01f9e5473..f5015a0a6 100644 --- a/nls/sl/gridx.js +++ b/nls/sl/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filter', clearButtonTitle: 'Počisti filter', - buildFilterMenuLabel: 'Izgradi filter…', + buildFilterMenuLabel: 'Izgradi filter...', apply: 'Uveljavi filter', //Sort diff --git a/nls/sv/gridx.js b/nls/sv/gridx.js index 5143302f3..bc6e86be1 100644 --- a/nls/sv/gridx.js +++ b/nls/sv/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Filter', clearButtonTitle: 'Rensa filter', - buildFilterMenuLabel: 'Bygg filter…', + buildFilterMenuLabel: 'Bygg filter...', apply: 'Använd filter', //Sort diff --git a/nls/th/gridx.js b/nls/th/gridx.js index bce9fb5c1..eb241c3d9 100644 --- a/nls/th/gridx.js +++ b/nls/th/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'ตัวกรอง', clearButtonTitle: 'เคลียร์ตัวกรอง', - buildFilterMenuLabel: 'สร้างตัวกรอง…', + buildFilterMenuLabel: 'สร้างตัวกรอง...', apply: 'ใช้ตัวกรอง', //Sort diff --git a/nls/tr/gridx.js b/nls/tr/gridx.js index c65df8a9e..32b23c831 100644 --- a/nls/tr/gridx.js +++ b/nls/tr/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: 'Süzgeç', clearButtonTitle: 'Süzgeci Temizle', - buildFilterMenuLabel: 'Süzgeç Oluştur…', + buildFilterMenuLabel: 'Süzgeç Oluştur...', apply: 'Süzgeci Uygula', //Sort diff --git a/nls/zh/gridx.js b/nls/zh/gridx.js index 26bd0cc3d..2b5a4086d 100644 --- a/nls/zh/gridx.js +++ b/nls/zh/gridx.js @@ -147,7 +147,7 @@ define({ //QuickFilter filterLabel: '过滤', clearButtonTitle: '清除过滤器', - buildFilterMenuLabel: '构建过滤器…', + buildFilterMenuLabel: '构建过滤器...', apply: '应用过滤器', //Sort diff --git a/tests/test_grid_filter.js b/tests/test_grid_filter.js index f329a4a3f..3fb9cba85 100644 --- a/tests/test_grid_filter.js +++ b/tests/test_grid_filter.js @@ -3,18 +3,38 @@ require([ 'gridx/tests/support/data/MusicData', 'gridx/tests/support/stores/Memory', 'dojo/store/JsonRest', + 'dojo/date/locale', 'gridx/Grid', 'gridx/core/model/cache/Sync', 'gridx/core/model/cache/Async', 'gridx/allModules', 'dojo/domReady!' -], function(parser, dataSource, storeFactory, JsonRest){ +], function(parser, dataSource, storeFactory, JsonRest, locale){ store = storeFactory({ dataSource: dataSource, size: 100 }); + var localDateFormatter = function(rawData) { + var date = rawData['Download Date']; + + if (rawData === undefined || rawData === null || + date === undefined || date === null) + { + return ""; + } else { + var item = new Date(date); + var localed = locale.format(item, {datePattern: "yyyy/M/d", selector: "date"}); + // return ''; + // return date; + console.log(localed); + return localed; + return locale.format(item, {datePattern: "yyyy/M/d", selector: "date"}); + } + }; + // DATE_S_FORMAT_OPTIONS: {datePattern: "yyyy/M/d", selector: "date"}, + layout = [ {id: 'id', field: 'id', name: 'Identity', dataType: 'number'}, {id: 'Genre', field: 'Genre', name: 'Genre', dataType: 'enum', encode: true, @@ -29,7 +49,7 @@ require([ {id: 'Length', field: 'Length', name: 'Length', dataType: 'string'}, {id: 'Track', field: 'Track', name: 'Track', dataType: 'number'}, {id: 'Composer', field: 'Composer', name: 'Composer', dataType: 'string'}, - {id: 'Download Date', field: 'Download Date', name: 'Download Date', dataType: 'date'}, + {id: 'Download Date', field: 'Download Date', name: 'Download Date', dataType: 'date', formatter: localDateFormatter}, {id: 'Date Time', field: 'datetime', name: 'Date Time', dataType: 'datetime'}, {id: 'Last Played', field: 'Last Played', name: 'Last Played', dataType: 'time'}, {id: 'Heard', field: 'Heard', name: 'Heard', dataType: 'boolean'} From 5da52a07c05d4218fcf78e7a575b3650f646e96b Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Thu, 16 Oct 2014 17:28:45 +0800 Subject: [PATCH 05/10] fix typo --- modules/Body.js | 30 +++++++++++++++--------------- modules/extendedSelect/Row.js | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/Body.js b/modules/Body.js index b01a6d2ec..b659719ef 100644 --- a/modules/Body.js +++ b/modules/Body.js @@ -64,10 +64,10 @@ define([ // Whether to show a visual effect when mouse hovering a row. rowHoverEffect: true, - // renderredIds: Object + // renderedIds: Object // This object contains the current renderred rows Ids. // For grid not using virtualVSroller, this is equal to current row ids in the grid body. - renderredIds: {}, + renderedIds: {}, // stuffEmptyCell: Boolean // Whether to stuff a cell with   if it is empty. stuffEmptyCell: true, @@ -267,7 +267,7 @@ define([ g = t.grid, dn = t.domNode = g.bodyNode; t._cellCls = {}; - t.renderredIds = {}; + t.renderedIds = {}; if(t.arg('rowHoverEffect')){ domClass.add(dn, 'gridxBodyRowHoverEffect'); } @@ -344,7 +344,7 @@ define([ autoUpdate: true, - renderredIds: {}, + renderedIds: {}, compareOnSet: function(v1, v2){ return typeof v1 == 'object' && typeof v2 == 'object' ? @@ -421,7 +421,7 @@ define([ domClass.toggle(t.domNode, 'gridxBodyRowHoverEffect', t.arg('rowHoverEffect')); // cache visual ids - // t.renderredIds = {}; + // t.renderedIds = {}; // domClass.add(loadingNode, 'gridxLoading'); t._showLoadingMask(); @@ -464,7 +464,7 @@ define([ t.onUnrender(id, 'refresh'); } domConstruct.destroy(n); - t.renderredIds[id] = undefined; + t.renderedIds[id] = undefined; n = tmp; } array.forEach(renderedRows, t.onAfterRow, t); @@ -604,11 +604,11 @@ define([ // id = n.firstChild.getAttribute('rowid'); // n.removeChild(n.firstChild); // if(g.model.isId(id)){ - // t.renderredIds[id] = undefined; + // t.renderedIds[id] = undefined; // } // } - // reset renderredIds since all rows in body are destroyed - t.renderredIds = {}; + // reset renderedIds since all rows in body are destroyed + t.renderedIds = {}; str = t._buildRows(start, count, uncachedRows, renderedRows); n.innerHTML = str; n.scrollTop = scrollTop; @@ -638,8 +638,8 @@ define([ id = n.firstChild.getAttribute('rowid'); n.removeChild(n.firstChild); } - //reset renderredIds since all rows in body are destroyed. - t.renderredIds = {}; + //reset renderedIds since all rows in body are destroyed. + t.renderedIds = {}; en.innerHTML = emptyInfo; en.style.zIndex = 1; t._hideLoadingMask(); @@ -666,7 +666,7 @@ define([ t.onUnrender(id, undefined, 'post'); } domConstruct.destroy(bn.lastChild); - t.renderredIds[id] = undefined; + t.renderedIds[id] = undefined; } }else{ var tp = bn.scrollTop; @@ -681,7 +681,7 @@ define([ t.onUnrender(id , undefined, 'pre'); } domConstruct.destroy(bn.firstChild); - t.renderredIds[id] = undefined; + t.renderedIds[id] = undefined; } t.renderStart += i; bn.scrollTop = tp > 0 ? tp : 0; @@ -796,7 +796,7 @@ define([ row = g.row(rowInfo.rowId, 1); s.push('
    Date: Thu, 16 Oct 2014 11:57:04 +0200 Subject: [PATCH 06/10] Update gridx.js The original was not correct dutch. This is. --- nls/nl/gridx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nls/nl/gridx.js b/nls/nl/gridx.js index e1bb18320..267e1fd80 100644 --- a/nls/nl/gridx.js +++ b/nls/nl/gridx.js @@ -1,7 +1,7 @@ define({ //Body loadingInfo: "Laden...", - emptyInfo: "Geen af te beelden items", + emptyInfo: "Er zijn geen items beschikbaar om weer te geven.", loadFailInfo: "Gegevens kunnen niet geladen worden.", loadMore: "Meer laden", loadMoreLoading: "Laden...", From 9c97d9aeff99ed2a4a4bc113a6f34d06416b9986 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 4 Nov 2014 14:42:08 +0800 Subject: [PATCH 07/10] fix rowheader height issue in test_grid_rowheader "RowHeader with CellWidget" case --- modules/RowHeader.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/RowHeader.js b/modules/RowHeader.js index 7a5cde752..28fa55b86 100644 --- a/modules/RowHeader.js +++ b/modules/RowHeader.js @@ -167,7 +167,7 @@ define([ }, _onAfterCell: function(cell){ - //This is to ensure the rowHeader get correct height for editable cells + //This is to ensuregit the rowHeader get correct height for editable cells var t = this, visualIndex = cell.row.visualIndex(), n = query('[visualindex="' + visualIndex + '"].gridxRowHeaderRow', t.bodyNode)[0], @@ -188,7 +188,7 @@ define([ function getHeight(){ return has('ie') <= 8 || t._isCollapse ? bodyNode.offsetHeight + 'px' : domStyle.getComputedStyle(bodyNode).height; } - // setTimeout(function(){ + setTimeout(function(){ h = getHeight(); if((h + '').indexOf('.') >= 0){ rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = bodyNode.style.height = bodyNode.clientHeight + 1 + 'px'; @@ -199,7 +199,7 @@ define([ // if(rowHeaderNode && rowHeaderNode.firstChild){ // rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = getHeight(); // } - // }, 0); + }, 0); }, _onRendered: function(start, count){ From ab18852947b2827634b558c48cda6c61aa409e6d Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 4 Nov 2014 14:51:01 +0800 Subject: [PATCH 08/10] fix rowHeaer._onAfterRow has null row issue --- modules/RowHeader.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/RowHeader.js b/modules/RowHeader.js index 28fa55b86..b18045a2c 100644 --- a/modules/RowHeader.js +++ b/modules/RowHeader.js @@ -151,6 +151,10 @@ define([ if(typeof row === 'string'){ row = this.grid.row(row, 1); } + if(!row){ + console.warn('rowHeader._onAfterRow, row is null'); + return; + } var t = this, visualIndex = row.visualIndex(), n = query('[visualindex="' + visualIndex + '"].gridxRowHeaderRow', t.bodyNode)[0], From 056f02057894d9db6572a4c7b2f03017d05e29e1 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Thu, 6 Nov 2014 09:55:49 +0800 Subject: [PATCH 09/10] tree descendant count implemented --- core/model/Model.js | 16 ++++++++++++++++ core/model/cache/Async.js | 2 +- modules/Tree.js | 21 +++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/core/model/Model.js b/core/model/Model.js index 471b13fbc..9bdc468cb 100644 --- a/core/model/Model.js +++ b/core/model/Model.js @@ -376,6 +376,22 @@ define([ return d; }, + _sizeAll: function(parentId){ + var size = this.size(parentId), i, childId, + count = 0; + + size = size === -1 ? 0 : size; + count += size; + + for(i = 0; i < size; i++){ + childId = this.indexToId(i, parentId); + console.log(childId); + count += this._sizeAll(childId); + } + + return count; + }, + //Events--------------------------------------------------------------------------------- onDelete: function(/*id, index*/){}, diff --git a/core/model/cache/Async.js b/core/model/cache/Async.js index cbf23e01a..1cecfe7d4 100644 --- a/core/model/cache/Async.js +++ b/core/model/cache/Async.js @@ -139,7 +139,7 @@ define([ //Minus index range list B from index range list A, //assuming A and B do not have overlapped ranges. //This is a set operation - if(!rangesB.length || !rangesA.length){ + if(!rangesB || !rangesB.length || !rangesA.length){ return rangesA; } var indexes = [], f = 0, r, res = [], diff --git a/modules/Tree.js b/modules/Tree.js index d530dcb37..78ce4da15 100644 --- a/modules/Tree.js +++ b/modules/Tree.js @@ -440,6 +440,27 @@ define([ return d; }, + loadChildRecursive: function(id){ + var d = new Deferred(), + t = this, + m = t.model; + + var i, dl = [], size = m.size(id); + // console.log(context.size); + m.when({start: 0, count: 1, parentId: id}, function(){ + size = m.size(id); + for(i = 0; i < size; ++i){ + var childId = m.indexToId(i, id); + dl.push(t.loadChildRecursive(childId)); + } + }).then(function(){ + new DeferredList(dl).then(function(){ + d.callback(); + }); + }); + return d; + }, + collapseRecursive: function(id, skipUpdateBody){ var d = new Deferred(), success = lang.hitch(d, d.callback), From f6dcd4c978035f741f0fa87127c1e3e946321d6e Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Thu, 6 Nov 2014 15:36:33 +0800 Subject: [PATCH 10/10] update version --- Grid.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Grid.js b/Grid.js index 73d62b954..5b5484642 100644 --- a/Grid.js +++ b/Grid.js @@ -49,7 +49,7 @@ define([ // - revision: Number: The Git rev from which dojo was pulled major: 1, minor: 3, - patch: 5, + patch: 6, flag: "", toString: function(){ return this.major + "." + this.minor + "." + this.patch + this.flag; // String diff --git a/package.json b/package.json index 192a6eebe..92af8fdac 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "dijit": "https://github.com/dojo/dijit/zipball/1.9.1", "dojox": "https://github.com/dojo/dojox/zipball/1.9.1" }, - "version": "1.3.5", + "version": "1.3.6", "maintainers":[ { "name": "Xiao Wen Zhu(Oliver)",