From 6e4c6cbe89d5df0b349ed05ce5a8253b8437d93a Mon Sep 17 00:00:00 2001 From: shanghaikid Date: Fri, 19 Dec 2014 15:53:57 +0800 Subject: [PATCH 01/17] Update Body.js you should always decorate the event as row event while events are happening on the div.gridxRow --- modules/Body.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/Body.js b/modules/Body.js index a760aef83..9a72db5be 100644 --- a/modules/Body.js +++ b/modules/Body.js @@ -975,6 +975,12 @@ define([ e.columnId = col.id; e.columnIndex = col.index; } + if(tag == 'div' && domClass.contains(n, 'gridxRow') && n.parentNode === g.bodyNode){ + e.rowId = n.getAttribute('rowid'); + e.parentId = n.getAttribute('parentid'); + e.rowIndex = parseInt(n.getAttribute('rowindex'), 10); + e.visualIndex = parseInt(n.getAttribute('visualindex'), 10); + } if(tag == 'table' && domClass.contains(n, 'gridxRowTable') && n.parentNode.parentNode === g.bodyNode){ n = n.parentNode; e.rowId = n.getAttribute('rowid'); From 4c7d9e751cd4a5f0585068b37d5579b1d8ed4f05 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Wed, 31 Dec 2014 15:01:03 +0800 Subject: [PATCH 02/17] fix match case in "equal" issue --- modules/Filter.js | 19 +++++++++++-------- modules/filter/FilterBar.js | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/modules/Filter.js b/modules/Filter.js index 6815b0827..eecf0373c 100644 --- a/modules/Filter.js +++ b/modules/Filter.js @@ -338,11 +338,11 @@ define([ }); //Util - function valueConvert(d, type, converter){ - if(lang.isFunction(converter)){ + function valueConvert(d, type, converter, caseSensitive) { + if (lang.isFunction(converter)) { d = converter(d); } - switch(type){ + switch (type) { case 'number': return parseFloat(d, 10); case 'boolean': @@ -371,7 +371,10 @@ define([ } return null; default: //string - return (d === null || d === undefined) ? '' : String(d); + d = d ? ((!caseSensitive) ? (d + '').toLowerCase() : d + '') : ''; + return d; + // return d ? ((!caseSensitive) ? (d + '').toLowerCase() : d + '') : ''; + // return (d === null || d === undefined) ? '' : String(d); } } @@ -401,17 +404,17 @@ define([ return lang.mixin(module, { //Data - column: function(/* String|Number */colId, /* String? */type, /* Function? */converter, /* Boolean? */useRawData){ + column: function(/* String|Number */colId, /* String? */type, /* Function? */converter, /* Boolean? */useRawData, caseSensitive){ type = String(type || 'string').toLowerCase(); return wrap(function(row){ if (typeof row.data === 'undefined') row.data = row._data(); - return valueConvert( row[useRawData ? 'rawData' : 'data'][colId], type, converter); + return valueConvert( row[useRawData ? 'rawData' : 'data'][colId], type, converter, caseSensitive); }, type, colId, {isCol: true}); }, - value: function(v, type, converter){ + value: function(v, type, converter, caseSensitive){ type = String(type || typeof v).toLowerCase(); - v = valueConvert(v, type, converter); + v = valueConvert(v, type, converter, caseSensitive); return wrap(function(){ return v; }, type, v); diff --git a/modules/filter/FilterBar.js b/modules/filter/FilterBar.js index 2f154bc52..1c4c08462 100644 --- a/modules/filter/FilterBar.js +++ b/modules/filter/FilterBar.js @@ -646,7 +646,7 @@ define([ c = c.replace(/^not/g, ''); c = c.charAt(0).toLowerCase() + c.substring(1); } - exp = F[c](F.column(colId, type, converter), c == 'isEmpty' ? null : F.value(dv, type), cs); + exp = F[c](F.column(colId, type, converter, false, cs), c == 'isEmpty' ? null : F.value(dv, type, null, cs), cs); if(isNot){exp = F.not(exp);} } return exp; From 4ce1809d8054107311b79217fc9ac718f0ded633 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Wed, 31 Dec 2014 15:48:14 +0800 Subject: [PATCH 03/17] fix [Gridx_FVT]Dod: [IE]The row detail content overlaps with grid body when expand --- modules/RowHeader.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/RowHeader.js b/modules/RowHeader.js index b18045a2c..6f339a34f 100644 --- a/modules/RowHeader.js +++ b/modules/RowHeader.js @@ -183,7 +183,7 @@ define([ //Check if the table is collasped. var t = this, h; - if(t._isCollapse === undefined){ + if (t._isCollapse === undefined) { var refNode = query('.gridxCell', t.grid.header.innerNode)[0]; t._isCollapse = refNode && domStyle.get(refNode, 'borderCollapse') == 'collapse'; } @@ -192,12 +192,13 @@ 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'; - - }else{ + if ((h + '').indexOf('.') >= 0) { + rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = bodyNode.firstChild.style.height = bodyNode.firstChild.clientHeight + 1 + 'px'; + //For IE,setting fixed height on row will break DOD. + // bodyNode.style.height = ''; + } else { rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = h; } // if(rowHeaderNode && rowHeaderNode.firstChild){ From 724b0f7129233aa490bda14233ad7da5a89419c8 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Mon, 5 Jan 2015 17:47:31 +0800 Subject: [PATCH 04/17] return defer in dod.refresh and dod.toggle --- modules/Dod.js | 34 +++++++++++++++++++++++----------- tests/test_grid_dod.js | 16 ++++++++++++++-- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/modules/Dod.js b/modules/Dod.js index f4ad1e584..50993787f 100644 --- a/modules/Dod.js +++ b/modules/Dod.js @@ -304,25 +304,37 @@ define([ return df; }, - toggle: function(row){ + toggle: function(row) { var row = typeof row === 'object' ? row : this.grid.row(row, 1/*isid*/); - var _row = this._row(row); - if(!_row || _row.inAnim || _row.inLoading){ - return; + var _row = this._row(row), + df = new Deferred(); + + if (!_row || _row.inAnim || _row.inLoading) { + df.errback("can't toggle now!"); + return df; } - if(this.isShown(row)){ - this.hide(row); - }else{ - this.show(row); + if (this.isShown(row)) { + df = this.hide(row); + } else { + df = this.show(row); } + + return df; }, refresh: function(row){ - var _row = this._row(row); - if(!_row || !_row.dodShown || _row.inAnim || _row.inLoading) return; + var _row = this._row(row), + df = new Deferred(); + + if(!_row || !_row.dodShown || _row.inAnim || _row.inLoading) { + df.errback("can't refresh now!"); + return df; + } _row.dodLoaded = false; _row.dodShown = false; - this.show(row); + df = this.show(row); + + return df; }, isShown: function(row){ diff --git a/tests/test_grid_dod.js b/tests/test_grid_dod.js index 02d1cd812..2e2eb971f 100644 --- a/tests/test_grid_dod.js +++ b/tests/test_grid_dod.js @@ -189,11 +189,23 @@ require([ }; window.toggleRow2Detail = function(){ - dod.toggle(grid.row('2')); + var df = dod.toggle(grid.row('2')); + + df.then(function() { + console.log('in dod toggle callback'); + }, function(err) { + console.warn(err); + }); }; window.refreshRow2Detail = function(){ - dod.refresh(grid.row('2')); + var df = dod.refresh(grid.row('2')); + + df.then(function() { + console.log('in dod refresh callback'); + }, function(err) { + console.warn(err); + }); }; window.isRow3DetailShown = function(){ From 77040f47889653c3809d57e7451f5e0d7f3ffc91 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 6 Jan 2015 09:48:00 +0800 Subject: [PATCH 05/17] dod comments update --- modules/Dod.js | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/modules/Dod.js b/modules/Dod.js index 50993787f..84e9198bc 100644 --- a/modules/Dod.js +++ b/modules/Dod.js @@ -62,9 +62,25 @@ define([ }, toggle: function(row){ + // summary: + // Hide the detail part of a row when it is showing. + // Show the detail part of a row when it is hidden. + // rowId: string + // The ID of a row. + // return: dojo.Deferred. + // A deferred object indicating when the toggle success or fail. }, refresh: function(row){ + // summary: + // When the dod of a specific row is open, refresh the content of dod. + // rowId: String + // The ID of a row + // return: dojo.Deferred + // A deferred object indicating when the detail refresh success or fail. + // When the dod of the row is open and the refresh successes, the defer will be resolved + // When the dod of the row is not open or the dod is in process of open/hide, + // the refresh will fail and the defer will be rejected. }, isShown: function(row){ @@ -110,9 +126,9 @@ define([ t.connect(t.grid, 'onCellKeyDown', '_onCellKeyDown'); t.connect(t.grid.body, '_onRowMouseOver', '_onRowMouseOver'); - //in IE, renderRow will use bodyNode.innerHTML = str, - //this will destroy all the node and _row.dodNode's innerHTML wil be destroyed, - //Here, manually set dodLoaded to false to force dod to re-render the dodNode + // In IE, renderRow will use bodyNode.innerHTML = str, + // this will destroy all the node and _row.dodNode's innerHTML wil be destroyed, + // Here, manually set dodLoaded to false to force dod to re-render the dodNode (has('ie') || has('trident')) && t.aspect(t.grid.body, 'renderRows', function(s, c, p){ if(p === 'top' || p === 'bottom'){ return; } var i, rowInfo, _row; @@ -153,7 +169,7 @@ define([ }, show: function(row){ - var row = typeof row === 'object' ? row : this.grid.row(row, 1/*isid*/); + row = typeof row === 'object' ? row : this.grid.row(row, 1/*isid*/); var _row = this._row(row), df = new Deferred(), g = this.grid; @@ -229,7 +245,7 @@ define([ }, hide: function(row){ - var row = typeof row === 'object' ? row : this.grid.row(row, 1/*isid*/); + row = typeof row === 'object' ? row : this.grid.row(row, 1/*isid*/); var rowHeaderNode, _row = this._row(row), g = this.grid, @@ -237,7 +253,7 @@ define([ df = new Deferred(), t = this; - if(!_row.dodShown || _row.inAnim || _row.inLoading){ + if (!_row.dodShown || _row.inAnim || _row.inLoading) { df.errback('Row Detail has already been hidden.'); return df; } @@ -305,7 +321,7 @@ define([ }, toggle: function(row) { - var row = typeof row === 'object' ? row : this.grid.row(row, 1/*isid*/); + row = typeof row === 'object' ? row : this.grid.row(row, 1/*isid*/); var _row = this._row(row), df = new Deferred(); @@ -338,7 +354,7 @@ define([ }, isShown: function(row){ - var row = typeof row === 'object' ? row : this.grid.row(row, 1/*isid*/); + row = typeof row === 'object' ? row : this.grid.row(row, 1/*isid*/); var _row = this._row(row); return !!_row.dodShown; }, From 3ca7eed6176e90b1a45a2396601369fd3380aa3d Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 6 Jan 2015 11:15:26 +0800 Subject: [PATCH 06/17] refresh detail when store get updated --- core/model/Model.js | 8 ++++---- modules/Dod.js | 29 +++++++++++++++++++---------- tests/test_grid_dod.js | 18 ++++++++++-------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/core/model/Model.js b/core/model/Model.js index 824a12752..c4b54c0f4 100644 --- a/core/model/Model.js +++ b/core/model/Model.js @@ -393,13 +393,13 @@ define([ }, //Events--------------------------------------------------------------------------------- - onDelete: function(/*id, index*/){}, + onDelete: function(/*id, index*/) {}, - onNew: function(/*id, index, row*/){}, + onNew: function(/*id, index, row*/) {}, - onSet: function(/*id, index, row*/){}, + onSet: function(/*id, index, row*/) {}, - onSizeChange: function(/*size, oldSize*/){}, + onSizeChange: function(/*size, oldSize*/) {}, //Package---------------------------------------------------------------------------- _msg: function(/* msg */){}, diff --git a/modules/Dod.js b/modules/Dod.js index 84e9198bc..f897a2c17 100644 --- a/modules/Dod.js +++ b/modules/Dod.js @@ -117,14 +117,18 @@ define([ }, load: function(args, deferStartup){ - var t =this, g = t.grid; + var t =this, + g = t.grid, + m = g.model; + t._rowMap = {}; - t.connect(t.grid.body, 'onAfterCell', '_onAfterCell'); - t.connect(t.grid.body, 'onAfterRow', '_onAfterRow'); - t.connect(t.grid.bodyNode, 'onclick', '_onBodyClick'); - t.connect(t.grid.body, 'onUnrender', '_onBodyUnrender'); - t.connect(t.grid, 'onCellKeyDown', '_onCellKeyDown'); - t.connect(t.grid.body, '_onRowMouseOver', '_onRowMouseOver'); + t.connect(g.body, 'onAfterCell', '_onAfterCell'); + t.connect(g.body, 'onAfterRow', '_onAfterRow'); + t.connect(g.bodyNode, 'onclick', '_onBodyClick'); + t.connect(g.body, 'onUnrender', '_onBodyUnrender'); + t.connect(g, 'onCellKeyDown', '_onCellKeyDown'); + t.connect(g.body, '_onRowMouseOver', '_onRowMouseOver'); + t.connect(m, 'onSet', '_onModelSet'); //When update store, detail should udpate. // In IE, renderRow will use bodyNode.innerHTML = str, // this will destroy all the node and _row.dodNode's innerHTML wil be destroyed, @@ -342,11 +346,12 @@ define([ var _row = this._row(row), df = new Deferred(); - if(!_row || !_row.dodShown || _row.inAnim || _row.inLoading) { + if (_row) _row.dodLoaded = false; + if (!_row || !_row.dodShown || _row.inAnim || _row.inLoading) { df.errback("can't refresh now!"); return df; } - _row.dodLoaded = false; + // _row.dodLoaded = false; _row.dodShown = false; df = this.show(row); @@ -392,6 +397,10 @@ define([ } return this._rowMap[id] || (this._rowMap[id] = {}); }, + + _onModelSet: function(id, index, row) { + this.refresh(id); + }, _onBodyClick: function(e){ if(!domClass.contains(e.target, 'gridxDodExpando') && @@ -575,7 +584,7 @@ define([ domStyle.set(_row.dodLoadingNode, 'display', 'none'); _row.inLoading = false; - //***for nested grid in grid **** + //***For nested grid in grid **** var gs = this.grid._nestedGrids = this.grid._nestedGrids? this.grid._nestedGrids : []; for(var i = 0; i < gridNodes.length; i++){ diff --git a/tests/test_grid_dod.js b/tests/test_grid_dod.js index 2e2eb971f..2baabab39 100644 --- a/tests/test_grid_dod.js +++ b/tests/test_grid_dod.js @@ -1,6 +1,7 @@ require([ 'dojo/dom-construct', 'dojo/parser', + 'dojo/Store/Memory', 'gridx/Grid', 'gridx/core/model/cache/Async', 'gridx/tests/support/data/MusicData', @@ -25,7 +26,7 @@ require([ 'dojox/charting/plot2d/OHLC', 'dojox/charting/plot2d/Pie', 'dojo/domReady!' -], function(domConstruct, parser, +], function(domConstruct, parser, Memory, Grid, Cache, dataSource, storeFactory, TestPane, focus, VirtualVScroller, Dod, SelectRow, extendedSelectRow, RowHeader, IndirectSelect, JulieTheme){ function random(start, end){ @@ -127,18 +128,20 @@ require([ addSeries("Series A", [-2, 1.1, 1.2, 1.3, 1.4, 1.5, -1.6]). addSeries("Series B", [1, 1.6, 1.3, 1.4, 1.1, 1.5, 1.1]). addSeries("Series C", [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6]). - setTheme(JulieTheme).render() - ; + setTheme(JulieTheme).render(); } + + var store = new Memory({data: dataSource.getData({ size : 100 })}); window.createGrid = function(){ if(window.grid){window.grid.destroy();} grid = new Grid({ id: 'grid', cacheClass: Cache, - store: storeFactory({ - dataSource: dataSource, - size: 100 - }), + // store: storeFactory({ + // dataSource: dataSource, + // size: 100 + // }), + store: store, modules: [ VirtualVScroller, RowHeader, @@ -163,7 +166,6 @@ require([ grid.placeAt('gridContainer'); grid.startup(); - window.dod = grid.dod; }; From b57f813e5d10fef9d1d75c9dfd127231f9b1806c Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 6 Jan 2015 14:50:46 +0800 Subject: [PATCH 07/17] fix model.onSet() triggered when adding new data --- core/model/cache/Sync.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/model/cache/Sync.js b/core/model/cache/Sync.js index a941e8b59..0044e8e53 100644 --- a/core/model/cache/Sync.js +++ b/core/model/cache/Sync.js @@ -409,16 +409,20 @@ define([ }, //-------------------------------------------------------------------------- - _onSet: function(item){ + _onSet: function(item, option) { var t = this, id = t.store.getIdentity(item), index = t.idToIndex(id), path = t.treePath(id), old = t._cache[id]; - if(path.length){ + + if (path.length) { t._addRow(id, index, t._itemToObject(item), item, path.pop()); } - t.onSet(id, index, t._cache[id], old); + if (!option || option.overwrite !== false) { // In new store, add() is using put(). + // Here to stop t.onSet when calling store.add() + t.onSet(id, index, t._cache[id], old); + } }, _onNew: function(item, parentInfo){ From ce8269dec60dac8affe63e2a6a3a498863eaad80 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Wed, 7 Jan 2015 16:02:48 +0800 Subject: [PATCH 08/17] fix Detail row disappears after adding a new row item --- Grid.js | 4 ++++ modules/Dod.js | 51 ++++++++++++++++++++++++++---------------- tests/test_grid_dod.js | 27 ++++++++++++++++++---- 3 files changed, 59 insertions(+), 23 deletions(-) diff --git a/Grid.js b/Grid.js index 5468dd225..d4be6f48f 100644 --- a/Grid.js +++ b/Grid.js @@ -66,6 +66,10 @@ define([ templateString: template, version: version, + + isIE: has('ie') || has('trident'), + + //textDir bidi support begin _setTextDirAttr: function(textDir){ // summary: diff --git a/modules/Dod.js b/modules/Dod.js index f897a2c17..1eff212b2 100644 --- a/modules/Dod.js +++ b/modules/Dod.js @@ -131,21 +131,25 @@ define([ t.connect(m, 'onSet', '_onModelSet'); //When update store, detail should udpate. // In IE, renderRow will use bodyNode.innerHTML = str, - // this will destroy all the node and _row.dodNode's innerHTML wil be destroyed, + // this will destroy all the node and _row.dodNode's innerHTML will also be destroyed. // Here, manually set dodLoaded to false to force dod to re-render the dodNode - (has('ie') || has('trident')) && t.aspect(t.grid.body, 'renderRows', function(s, c, p){ - if(p === 'top' || p === 'bottom'){ return; } - var i, rowInfo, _row; - for(i = s; i < s + c; i++){ - rowInfo = g.view.getRowInfo({visualIndex: i}); - _row = t._rowMap[rowInfo.rowId]; - if(_row){ - _row.dodLoaded = false; - _row.dodLoadingNode = null; - _row.dodNode = null; + if (g.isIE) { + // (has('ie') || has('trident')) && + t.aspect(t.grid.body, 'renderRows', function(s, c, p) { + if(p === 'top' || p === 'bottom') return; + + var i, rowInfo, _row, temp, + rm = t._rowMap; + + for (var k in rm) { + temp = rm[k]; + temp.dodLoaded = false; + temp.dodLoadingNode = null; + temp.dodNode = null; + // temp.dodShown = false; } - } - }, t, 'before'); + }, t, 'before'); + } if(t.grid.columnResizer){ t.connect(t.grid.columnResizer, 'onResize', '_onColumnResize'); @@ -218,10 +222,10 @@ define([ domClass.add(node, 'gridxDodShown'); //domStyle.set(_row.dodNode, 'display', 'none'); - if(_row.dodLoaded){ + if (_row.dodLoaded) { this._detailLoadComplete(row, df); return df; - }else{ + } else { domStyle.set(_row.dodLoadingNode, 'display', 'block'); if(g.autoHeight){ g.vLayout.reLayout(); @@ -434,9 +438,12 @@ define([ } }, - _onAfterRow: function(row){ - var _row = this._row(row); - if(this.arg('showExpando')){ + _onAfterRow: function(row) { + var _row = this._row(row), + t = this, + g = t.grid; + + if(this.arg('showExpando')) { var tbl = query('table', row.node())[0]; var cell = tbl.rows[0].cells[0]; var span = domConstruct.create('span', { @@ -449,7 +456,13 @@ define([ if(this.isShown(row) || (this.arg('defaultShow') && _row.dodShown === undefined)){ _row.dodShown = false; _row.defaultShow = true; - this.show(row); + if (g.isIE) { + setTimeout(function() { + t.show(row); + }, 10); + } else { + t.show(row); + } } }, diff --git a/tests/test_grid_dod.js b/tests/test_grid_dod.js index 2baabab39..e101e129f 100644 --- a/tests/test_grid_dod.js +++ b/tests/test_grid_dod.js @@ -28,10 +28,11 @@ require([ 'dojo/domReady!' ], function(domConstruct, parser, Memory, Grid, Cache, dataSource, storeFactory, TestPane, - focus, VirtualVScroller, Dod, SelectRow, extendedSelectRow, RowHeader, IndirectSelect, JulieTheme){ + focus, VirtualVScroller, Dod, SelectRow, extendedSelectRow, + RowHeader, IndirectSelect, JulieTheme){ function random(start, end){ //include start but not end. e.g. 1-10, 1 is possible but not 10. - return Math.floor(Math.random()*(end-start)) + start; + return Math.floor(Math.random() * (end - start)) + start; } function getDummyText(count, end){ var arr = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. Phasellus dolor. Maecenas vestibulum mollis diam. Pellentesque ut neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In dui magna, posuere eget, vestibulum et, tempor auctor, justo. In ac felis quis tortor malesuada pretium. Pellentesque auctor neque nec urna. Proin sapien ipsum, porta a, auctor quis, euismod ut, mi. Aenean viverra rhoncus pede. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut non enim eleifend felis pretium feugiat. Vivamus quis mi. Phasellus a est. Phasellus magna. In hac habitasse platea dictumst. Curabitur at lacus ac velit ornare lobortis. Curabitur a felis in nunc fringilla tristique. Morbi mattis ullamcorper velit. Phasellus gravida semper nisi. Nullam vel sem. Pellentesque libero tortor, tincidunt et, tincidunt eget, semper nec, quam. Sed hendrerit. Morbi ac felis. Nunc egestas, augue at pellentesque laoreet, felis eros vehicula leo, at malesuada velit leo quis pede. Donec interdum, metus et hendrerit aliquet, dolor diam sagittis ligula, eget egestas libero turpis vel mi. Nunc nulla. Fusce risus nisl, viverra et, tempor et, pretium in, sapien. Donec venenatis vulputate lorem. Morbi nec metus. Phasellus blandit leo ut odio. Maecenas ullamcorper, dui et placerat feugiat, eros pede varius nisi, condimentum viverra felis nunc et lorem. Sed magna purus, fermentum eu, tincidunt eu, varius ut, felis. In auctor lobortis lacus. Quisque libero metus, condimentum nec, tempor a, commodo mollis, magna. Vestibulum ullamcorper mauris at ligula. Fusce fermentum. Nullam cursus lacinia erat. Praesent blandit laoreet nibh. Fusce convallis metus id felis luctus adipiscing. Pellentesque egestas, neque sit amet convallis pulvinar, justo nulla eleifend augue, ac auctor orci leo non est. Quisque id mi. Ut tincidunt tincidunt erat. Etiam feugiat lorem non metus. Vestibulum dapibus nunc ac augue. Curabitur vestibulum aliquam leo. Praesent egestas neque eu enim. In hac habitasse platea dictumst. Fusce a quam. Etiam ut purus mattis mauris sodales aliquam. Curabitur nisi. Quisque malesuada placerat nisl. Nam ipsum risus, rutrum vitae, vestibulum eu, molestie vel, lacus. Sed augue ipsum, egestas nec, vestibulum et, malesuada adipiscing, dui. Vestibulum facilisis, purus nec pulvinar iaculis, ligula mi congue nunc, vitae euismod ligula urna in dolor. Mauris sollicitudin fermentum libero. Praesent nonummy mi in odio. Nunc interdum lacus sit amet orci. Vestibulum rutrum, mi nec elementum vehicula, eros quam gravida nisl, id fringilla neque ante vel mi. Morbi mollis tellus ac sapien. Phasellus volutpat, metus eget egestas mollis, lacus lacus blandit dui, id egestas quam mauris ut lacus. Fusce vel dui. Sed in libero ut nibh placerat accumsan. Proin faucibus arcu quis ante. In consectetuer turpis ut velit. Nulla sit amet est. Praesent metus tellus, elementum eu, semper a, adipiscing nec, purus. Cras risus ipsum, faucibus ut, ullamcorper id, varius ac, leo. Suspendisse feugiat. Suspendisse enim turpis, dictum sed, iaculis a, condimentum nec, nisi. Praesent nec nisl a purus blandit viverra. Praesent ac massa at ligula laoreet iaculis. Nulla neque dolor, sagittis eget, iaculis quis, molestie non, velit. Mauris turpis nunc, blandit et, volutpat molestie, porta ut, ligula. Fusce pharetra convallis urna. Quisque ut nisi. Donec mi odio, faucibus at, scelerisque quis, convallis in, nisi. Suspendisse non nisl sit amet velit hendrerit rutrum. Ut leo. Ut a nisl id ante tempus hendrerit. Proin pretium, leo ac pellentesque mollis, felis nunc ultrices eros, sed gravida augue augue mollis justo. Suspendisse eu ligula. Nulla facilisi. Donec id justo. Praesent porttitor, nulla vitae posuere iaculis, arcu nisl dignissim dolor, a pretium mi sem ut ipsum. Curabitur suscipit suscipit tellus. Praesent vestibulum dapibus nibh. Etiam iaculis nunc ac metus. Ut id nisl quis enim dignissim sagittis. Etiam sollicitudin, ipsum eu pulvinar rutrum, tellus ipsum laoreet sapien, quis venenatis ante odio sit amet eros. Proin magna. Duis vel nibh at velit scelerisque suscipit. Curabitur turpis. Vestibulum suscipit nulla quis orci. Fusce ac felis sit amet ligula pharetra condimentum. Maecenas egestas arcu quis ligula mattis placerat. Duis lobortis massa imperdiet quam. Suspendisse potenti. Pellentesque commodo eros a enim. Vestibulum turpis sem, aliquet eget, lobortis pellentesque, rutrum eu, nisl. Sed libero. Aliquam erat volutpat. Etiam vitae tortor. Morbi vestibulum volutpat enim. Aliquam eu nunc. Nunc sed turpis. Sed mollis, eros et ultrices tempus, mauris ipsum aliquam libero, non adipiscing dolor urna a orci. Nulla porta dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Pellentesque dapibus hendrerit tortor. Praesent egestas tristique nibh. Sed a libero. Cras varius. Donec vitae orci sed dolor rutrum auctor. Fusce egestas elit eget lorem. Suspendisse nisl elit, rhoncus eget, elementum ac, condimentum eget, diam. Nam at tortor in tellus interdum sagittis. Aliquam lobortis. Donec orci lectus, aliquam ut, faucibus non, euismod id, nulla. Curabitur blandit mollis lacus. Nam adipiscing. Vestibulum eu odio. Vivamus laoreet. Nullam tincidunt adipiscing enim. Phasellus tempus. Proin viverra, ligula sit amet ultrices semper, ligula arcu tristique sapien, a accumsan nisi mauris ac eros. Fusce neque. Suspendisse faucibus, nunc et pellentesque egestas, lacus ante convallis tellus, vitae iaculis lacus elit id tortor. Vivamus aliquet elit ac nisl. Fusce fermentum odio nec arcu. Vivamus euismod mauris. In ut quam vitae odio lacinia tincidunt. Praesent ut ligula non mi varius sagittis. Cras sagittis. Praesent ac sem eget est egestas volutpat. Vivamus consectetuer hendrerit lacus. Cras non dolor. Vivamus in erat ut urna cursus vestibulum. Fusce commodo aliquam arcu. Nam commodo suscipit quam. Quisque id odio. Praesent venenatis metus at tortor pulvinar varius. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. Phasellus dolor. Maecenas vestibulum mollis diam. Pellentesque ut neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In dui magna, posuere eget, vestibulum et, tempor auctor, justo. In ac felis quis tortor malesuada pretium. Pellentesque auctor neque nec urna. Proin sapien ipsum, porta a, auctor quis, euismod ut, mi. Aenean viverra rhoncus pede. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut non enim eleifend felis pretium feugiat. Vivamus quis mi. Phasellus a est. Phasellus magna. In hac habitasse platea dictumst. Curabitur at lacus ac velit ornare lobortis. Curabitur a felis in nunc fringilla tristique. Morbi mattis ullamcorper velit. Phasellus gravida semper nisi. Nullam vel sem. Pellentesque libero tortor, tincidunt et, tincidunt eget, semper nec, quam. Sed hendrerit. Morbi ac felis. '.split(' '); @@ -131,7 +132,7 @@ require([ setTheme(JulieTheme).render(); } - var store = new Memory({data: dataSource.getData({ size : 100 })}); + var store = new Memory({data: dataSource.getData({ size : 100})}); window.createGrid = function(){ if(window.grid){window.grid.destroy();} grid = new Grid({ @@ -169,6 +170,23 @@ require([ window.dod = grid.dod; }; + window.addRow = function(){ + window.grid.store.add( + { + Heard: true, + Progress: 0.5, + Genre: "Progressive Rock", + Artist:"Dixie dregs", + Year:1977, + Album:"Free Fall", + Name:"Holiday", + Length:"04:29", + Track:2, + Composer:"Steven J. Morse", + "Download Date":"2035/8/13", "Last Played":"17:17:49" + }); + }; + createGrid(); var tp = new TestPane({}); @@ -239,7 +257,8 @@ require([ '
', '
', - '
Re Create Grid
' + '
Re Create Grid
', + '
Add Row
' ].join('')); tp.addTestSet('Dod APIs', [ From 0be834077d748ac32a0f638d0df9e6cb877a2564 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Wed, 7 Jan 2015 16:34:44 +0800 Subject: [PATCH 09/17] update dod test page --- tests/test_grid_dod.html | 2 +- tests/test_grid_dod.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_grid_dod.html b/tests/test_grid_dod.html index 57b4fe3e6..784ce5dab 100644 --- a/tests/test_grid_dod.html +++ b/tests/test_grid_dod.html @@ -19,7 +19,7 @@

- Grid with the Detail on demand + Grid with the Detail on demand(Dod)

diff --git a/tests/test_grid_dod.js b/tests/test_grid_dod.js index e101e129f..bce08cd4b 100644 --- a/tests/test_grid_dod.js +++ b/tests/test_grid_dod.js @@ -132,7 +132,7 @@ require([ setTheme(JulieTheme).render(); } - var store = new Memory({data: dataSource.getData({ size : 100})}); + var store = new Memory({data: dataSource.getData({size : 100})}); window.createGrid = function(){ if(window.grid){window.grid.destroy();} grid = new Grid({ From a46752c4b7a7f349daa098df0fd6ec3aea7680e6 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Fri, 9 Jan 2015 14:24:09 +0800 Subject: [PATCH 10/17] fix Dnd error when dnd rows --- modules/Body.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/Body.js b/modules/Body.js index 9a72db5be..02ef57171 100644 --- a/modules/Body.js +++ b/modules/Body.js @@ -1008,8 +1008,8 @@ define([ row = g.row(id, 1), rowNode = row && row.node(); if(rowNode){ - var curData = rowCache.data, - oldData = oldCache.data, + var curData = rowCache.data || rowCache._data(), + oldData = oldCache.data || oldCache._data(), cols = g._columns, renderWhole = t.arg('renderWholeRowOnSet'), compareOnSet = t.arg('compareOnSet'); From e70d6bb3d27178ba32b72ccfb6a3f3f368382311 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Fri, 9 Jan 2015 17:25:29 +0800 Subject: [PATCH 11/17] fix tree select partial status issue --- core/model/extensions/Mark.js | 57 +++++++++++++++++++++++++++++------ tests/test_grid_tree.html | 2 +- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/core/model/extensions/Mark.js b/core/model/extensions/Mark.js index f27c36638..512ffed36 100644 --- a/core/model/extensions/Mark.js +++ b/core/model/extensions/Mark.js @@ -316,6 +316,37 @@ define([ } }, + _updateChildren: function(id, tp, toMark, noEvent) { + var t = this, + byId = t._byId[tp], + last = t._last[tp], + lazy = t._lazy[tp], + m = t.model, + mm = m._model, + children = mm._call('children', [id]), + ids = children, + childId, oldState, newState; + + while (ids.length) { + childId = ids.shift(); + oldState = byId[childId] || 0; + newState = toMark === 1 ? last[childId] : toMark; + byId[childId] = newState; + // last[childId] = newState; + if (!noEvent) { + t._fireEvent(childId, tp, newState, oldState); + } + if (mm._call('hasChildren', [childId])) { + children = mm._call('children', [childId]); + if (children.length) { + ids = ids.concat(children); + } else { + lazy[childId] = toMark; + } + } + } + }, + _doMark: function(id, tp, toMark, skipParent, noEvent){ var i, ids, children, childId, treePath, t = this, @@ -327,6 +358,7 @@ define([ // selectable = t._byId['selectable'], oldState = byId[id] || 0, newState; + if(t._tree[tp]){ children = mm._call('children', [id]); if(toMark == 1 && array.every(children, function(childId){ @@ -340,22 +372,27 @@ define([ t._fireEvent(id, tp, toMark, oldState); } if(t._tree[tp]){ - ids = [id]; + ids = mm._call('children', [id]); + + // ids = [children]; while(ids.length){ childId = ids.shift(); oldState = byId[childId] || 0; - newState = byId[childId] = toMark == 1 ? last[childId] || 0 : toMark; + newState = toMark == 1 ? last[childId] || 0 : toMark; + byId[childId] = newState; + this._updateChildren(childId, tp, newState, noEvent); + // last[childId] = newState; if(!noEvent){ t._fireEvent(childId, tp, newState, oldState); } - if(mm._call('hasChildren', [childId])){ - children = mm._call('children', [childId]); - if(children.length){ - ids = ids.concat(children); - }else{ - lazy[childId] = toMark; - } - } + // if(mm._call('hasChildren', [childId])){ + // children = mm._call('children', [childId]); + // if(children.length){ + // ids = ids.concat(children); + // }else{ + // lazy[childId] = toMark; + // } + // } } if(!skipParent){ treePath = mm._call('treePath', [id]); diff --git a/tests/test_grid_tree.html b/tests/test_grid_tree.html index bda6ee674..50070e0f3 100644 --- a/tests/test_grid_tree.html +++ b/tests/test_grid_tree.html @@ -7,7 +7,7 @@ From 336546888227854511837901571fbffe411cfa81 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 13 Jan 2015 11:03:50 +0800 Subject: [PATCH 12/17] Revert "fix tree select partial status issue" This reverts commit e70d6bb3d27178ba32b72ccfb6a3f3f368382311. --- core/model/extensions/Mark.js | 57 ++++++----------------------------- tests/test_grid_tree.html | 2 +- 2 files changed, 11 insertions(+), 48 deletions(-) diff --git a/core/model/extensions/Mark.js b/core/model/extensions/Mark.js index 512ffed36..f27c36638 100644 --- a/core/model/extensions/Mark.js +++ b/core/model/extensions/Mark.js @@ -316,37 +316,6 @@ define([ } }, - _updateChildren: function(id, tp, toMark, noEvent) { - var t = this, - byId = t._byId[tp], - last = t._last[tp], - lazy = t._lazy[tp], - m = t.model, - mm = m._model, - children = mm._call('children', [id]), - ids = children, - childId, oldState, newState; - - while (ids.length) { - childId = ids.shift(); - oldState = byId[childId] || 0; - newState = toMark === 1 ? last[childId] : toMark; - byId[childId] = newState; - // last[childId] = newState; - if (!noEvent) { - t._fireEvent(childId, tp, newState, oldState); - } - if (mm._call('hasChildren', [childId])) { - children = mm._call('children', [childId]); - if (children.length) { - ids = ids.concat(children); - } else { - lazy[childId] = toMark; - } - } - } - }, - _doMark: function(id, tp, toMark, skipParent, noEvent){ var i, ids, children, childId, treePath, t = this, @@ -358,7 +327,6 @@ define([ // selectable = t._byId['selectable'], oldState = byId[id] || 0, newState; - if(t._tree[tp]){ children = mm._call('children', [id]); if(toMark == 1 && array.every(children, function(childId){ @@ -372,27 +340,22 @@ define([ t._fireEvent(id, tp, toMark, oldState); } if(t._tree[tp]){ - ids = mm._call('children', [id]); - - // ids = [children]; + ids = [id]; while(ids.length){ childId = ids.shift(); oldState = byId[childId] || 0; - newState = toMark == 1 ? last[childId] || 0 : toMark; - byId[childId] = newState; - this._updateChildren(childId, tp, newState, noEvent); - // last[childId] = newState; + newState = byId[childId] = toMark == 1 ? last[childId] || 0 : toMark; if(!noEvent){ t._fireEvent(childId, tp, newState, oldState); } - // if(mm._call('hasChildren', [childId])){ - // children = mm._call('children', [childId]); - // if(children.length){ - // ids = ids.concat(children); - // }else{ - // lazy[childId] = toMark; - // } - // } + if(mm._call('hasChildren', [childId])){ + children = mm._call('children', [childId]); + if(children.length){ + ids = ids.concat(children); + }else{ + lazy[childId] = toMark; + } + } } if(!skipParent){ treePath = mm._call('treePath', [id]); diff --git a/tests/test_grid_tree.html b/tests/test_grid_tree.html index 50070e0f3..bda6ee674 100644 --- a/tests/test_grid_tree.html +++ b/tests/test_grid_tree.html @@ -7,7 +7,7 @@ From 8c371d6192e8d4a8899c7468410ed1c06c25bf6f Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 13 Jan 2015 13:13:41 +0800 Subject: [PATCH 13/17] fix tree select partial status issue --- core/model/extensions/Mark.js | 14 ++++++++++++-- modules/Body.js | 3 ++- tests/test_grid_tree.html | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/core/model/extensions/Mark.js b/core/model/extensions/Mark.js index f27c36638..a0fafe450 100644 --- a/core/model/extensions/Mark.js +++ b/core/model/extensions/Mark.js @@ -274,6 +274,7 @@ define([ _fireEvent: function(id, type, toMark, oldState){ var t = this, m = t.model; + // debugger; if(toMark != oldState){ if(!toMark){ delete t._byId[type][id]; @@ -326,7 +327,8 @@ define([ lazy = t._lazy[tp], // selectable = t._byId['selectable'], oldState = byId[id] || 0, - newState; + newState, parent; + if(t._tree[tp]){ children = mm._call('children', [id]); if(toMark == 1 && array.every(children, function(childId){ @@ -344,7 +346,15 @@ define([ while(ids.length){ childId = ids.shift(); oldState = byId[childId] || 0; - newState = byId[childId] = toMark == 1 ? last[childId] || 0 : toMark; + newState = byId[childId] = toMark == 1 ? last[childId] || undefined : toMark; + + if (newState === undefined) { + parent = mm._call('treePath', [childId]); + newState = byId[parent.pop()]; + newState = newState === 1 ? 0 : newState; + byId[childId] = newState; + } + if(!noEvent){ t._fireEvent(childId, tp, newState, oldState); } diff --git a/modules/Body.js b/modules/Body.js index 02ef57171..425423b8b 100644 --- a/modules/Body.js +++ b/modules/Body.js @@ -462,9 +462,10 @@ define([ //Set a special flag so that RowHeader won't destroy its nodes. //FIXME: this is ugly... t.onUnrender(id, 'refresh'); + t.renderedIds[id] = undefined; } domConstruct.destroy(n); - t.renderedIds[id] = undefined; + // t.renderedIds[id] = undefined; n = tmp; } array.forEach(renderedRows, t.onAfterRow, t); diff --git a/tests/test_grid_tree.html b/tests/test_grid_tree.html index bda6ee674..f3081b5d9 100644 --- a/tests/test_grid_tree.html +++ b/tests/test_grid_tree.html @@ -7,7 +7,7 @@ From 466cb18b2059851ebd9d153cf0d4bba95f3deda2 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 13 Jan 2015 16:59:39 +0800 Subject: [PATCH 14/17] fix tree selection issue --- core/model/extensions/Mark.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/core/model/extensions/Mark.js b/core/model/extensions/Mark.js index a0fafe450..28c155a97 100644 --- a/core/model/extensions/Mark.js +++ b/core/model/extensions/Mark.js @@ -318,7 +318,7 @@ define([ }, _doMark: function(id, tp, toMark, skipParent, noEvent){ - var i, ids, children, childId, treePath, + var i, ids, children, childId, treePath, childrenLen, t = this, m = t.model, mm = m._model, @@ -331,12 +331,24 @@ define([ if(t._tree[tp]){ children = mm._call('children', [id]); - if(toMark == 1 && array.every(children, function(childId){ - return (last[childId] || 0) == (last[children[0]] || 0); - })){ - toMark = 2; + childrenLen = children.length; + + if (toMark === 1) { + if (childrenLen > 1) { + if(array.every(children, function(childId){ + return (last[childId] || 0) == (last[children[0]] || 0); + })){ + toMark = 2; + } + + } else if(childrenLen === 1) { + toMark = last[children[0]] === 1 ? 1 : 2; + } else { //without children rows + toMark = 2; + } } } + byId[id] = last[id] = toMark; if(!noEvent){ t._fireEvent(id, tp, toMark, oldState); From e79273c31a7fdb61cd9d603e47d38a9c6786af8e Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Fri, 16 Jan 2015 10:53:34 +0800 Subject: [PATCH 15/17] fix error in extendedSelect test page --- tests/test_grid_extendedSelect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_grid_extendedSelect.js b/tests/test_grid_extendedSelect.js index 9a8252851..48218f7b5 100644 --- a/tests/test_grid_extendedSelect.js +++ b/tests/test_grid_extendedSelect.js @@ -43,7 +43,7 @@ grid.startup(); connect.connect(grid.select.row, 'onSelectionChange', function(selected, lastSelected){ // dom.byId('rowSelectedCount').value = selected.length; - dom.byId('lastRowStatus').value = lastSelected.join("\n"); + dom.byId('lastRowStatus').value = lastSelected && lastSelected.join("\n"); }); connect.connect(grid.select.row, 'onSelectionChange', function(selected){ dom.byId('rowSelectedCount').value = selected.length; From 2cf7861fcbdb88df349320c5a830578f5004ef51 Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Fri, 16 Jan 2015 16:54:11 +0800 Subject: [PATCH 16/17] fix rowHeader error in IE --- modules/RowHeader.js | 8 ++++---- tests/test_grid_resize.html | 5 +++-- tests/test_grid_tree.js | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/RowHeader.js b/modules/RowHeader.js index 6f339a34f..1958a73c1 100644 --- a/modules/RowHeader.js +++ b/modules/RowHeader.js @@ -199,11 +199,11 @@ define([ //For IE,setting fixed height on row will break DOD. // bodyNode.style.height = ''; } else { - rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = h; + // rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = h; + if(rowHeaderNode && rowHeaderNode.firstChild){ + rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = h; + } } - // if(rowHeaderNode && rowHeaderNode.firstChild){ - // rowHeaderNode.style.height = rowHeaderNode.firstChild.style.height = getHeight(); - // } }, 0); }, diff --git a/tests/test_grid_resize.html b/tests/test_grid_resize.html index 8cc88ff26..1aa406a6a 100644 --- a/tests/test_grid_resize.html +++ b/tests/test_grid_resize.html @@ -44,7 +44,7 @@ -

Grid Resize

+

Grid Resize

@@ -65,7 +65,8 @@

Grid Resize

container:"bottomDecoration", count:11, maximum:500, constraints:{pattern:"#px"}'> - + +