Skip to content

Commit

Permalink
merge in latest updates
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxw committed Jun 7, 2012
1 parent cfaed77 commit 277bbd3
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 70 deletions.
30 changes: 14 additions & 16 deletions modules/Dod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ define([
"../core/_Module",
"dojo/_base/declare",
"dojo/_base/html",
"dojo/hccss",
"dojo/fx",
"dojo/query"
], function(dojo, _Module, declare, html, has, fx, query){
], function(dojo, _Module, declare, html, fx, query){
return declare(/*===== "gridx.modules.Dod", =====*/_Module, {
name: 'dod',
required: ['body'],
Expand All @@ -33,6 +32,7 @@ define([
this.connect(this.grid.columnResizer, 'onResize', '_onColumnResize');
}
this.loaded.callback();

},
getAPIPath: function(){
return {
Expand Down Expand Up @@ -70,9 +70,7 @@ define([
if(_row.dodShown || _row.inAnim){return;}

_row.dodShown = true;
if(has('highcontrast')){
this._getExpando(row).innerHTML = '-';
}
this._getExpando(row).firstChild.innerHTML = '-';

var node = row.node(), w = node.scrollWidth;
if(!_row.dodLoadingNode){
Expand Down Expand Up @@ -120,9 +118,7 @@ define([
if(!_row.dodShown || _row.inAnim){return;}
html.removeClass(row.node(), 'gridxDodShown');
html.style(_row.dodLoadingNode, 'display', 'none');
if(has('highcontrast')){
this._getExpando(row).innerHTML = '+';
}
this._getExpando(row).firstChild.innerHTML = '+';
_row.inAnim = true;
fx.wipeOut({
node: _row.dodNode,
Expand Down Expand Up @@ -167,7 +163,7 @@ define([
},

_onBodyClick: function(e){
if(!html.hasClass(e.target, 'gridxDodExpando')){return;}
if(!html.hasClass(e.target, 'gridxDodExpando') && !html.hasClass(e.target, 'gridxDodExpandoText')){return;}
var node = e.target;
while(node && !html.hasClass(node, 'gridxRow')){
node = node.parentNode;
Expand All @@ -178,20 +174,22 @@ define([

_onAfterRow: function(row){
var _row = this._row(row);
if(this.isShown(row) || (this.arg('defaultShow') && _row.dodShown === undefined)){
_row.dodShown = false;
_row.defaultShow = true;
this.show(row);
}

if(this.arg('showExpando')){
var tbl = dojo.query('table', row.node())[0];
var cell = tbl.rows[0].cells[0];
var span = dojo.create('span', {
className: 'gridxDodExpando',
innerHTML: has('highcontrast') ? '+' : ''
innerHTML: '<span class="gridxDodExpandoText">'
+ (this.defaultShow ? '-' : '+') + '</span>'
}, cell, 'first');
}

if(this.isShown(row) || (this.arg('defaultShow') && _row.dodShown === undefined)){
_row.dodShown = false;
_row.defaultShow = true;
this.show(row);
}

},

_onColumnResize: function(){
Expand Down
39 changes: 16 additions & 23 deletions modules/NestedSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ define([
"dojo/_base/event",
"dojo/_base/query",
"dojo/_base/window",
"dojo/hccss",
"dojo/string",
"dojo/dom-class",
"dojo/dom-construct",
Expand All @@ -14,7 +13,7 @@ define([
"../core/_Module",
"../core/model/extensions/Sort",
"dojo/i18n!../nls/NestedSort"
], function(declare, array, connect, event, query, win, has, string, domClass, domConstruct, domStyle, keys, _Module, Sort, nls){
], function(declare, array, connect, event, query, win, string, domClass, domConstruct, domStyle, keys, _Module, Sort, nls){

var forEach = array.forEach,
filter = array.filter,
Expand All @@ -33,11 +32,11 @@ define([
modelExtensions: [Sort],

_a11yText: {
'dojoxGridDescending' : '&#9662;',
'dojoxGridAscending' : '&#9652;',
'dojoxGridAscendingTip' : '&#1784;',
'dojoxGridDescendingTip': '&#1783;',
'dojoxGridUnsortedTip' : 'x' //'&#10006;'
'dojoxGridDescending' : '<span class="gridxNestedSortBtnText">&#9662;</span>',
'dojoxGridAscending' : '<span class="gridxNestedSortBtnText">&#9652;</span>',
'dojoxGridAscendingTip' : '<span class="gridxNestedSortBtnText">&#1784;</span>',
'dojoxGridDescendingTip': '<span class="gridxNestedSortBtnText">&#1783;</span>',
'dojoxGridUnsortedTip' : '<span class="gridxNestedSortBtnText">x</span>' //'&#10006;'
},

constructor: function(){
Expand Down Expand Up @@ -162,6 +161,9 @@ define([
btn = e.target,
sortData = t._sortData,
colid;
if(hasClass(btn, 'gridxNestedSortBtnText')){
btn = btn.parentNode;
}
t._markFocus(e);
if(hasClass(btn, 'gridxSortBtn')){
colid = btn.parentNode.getAttribute('colid');
Expand Down Expand Up @@ -226,8 +228,7 @@ define([
var t = this,
g = t.grid,
dn = g.domNode,
sortData = t._sortData
a11y = has("highcontrast");
sortData = t._sortData;
removeClass(dn, 'gridxSingleSorted');
removeClass(dn, 'gridxNestedSorted');
query('th', g.header.domNode).forEach(function(cell){
Expand All @@ -241,8 +242,8 @@ define([
a11yText = t._a11yText;
singleBtn.title = nls.singleSort + ' - ' + nls.ascending;
nestedBtn.title = nls.nestedSort + ' - ' + nls.ascending;
singleBtn.innerHTML = a11y ? a11yText.dojoxGridAscendingTip : '&nbsp;';
nestedBtn.innerHTML = sortData.length + 1 + (a11y ? a11yText.dojoxGridAscendingTip : '');
singleBtn.innerHTML = a11yText.dojoxGridAscendingTip + '&nbsp;';
nestedBtn.innerHTML = sortData.length + 1 + a11yText.dojoxGridAscendingTip;
var d = filter(sortData, function(data){
return data.colId === colid;
})[0];
Expand All @@ -258,27 +259,19 @@ define([
addClass(cell, 'gridxCellSortedDesc');
if(len == 1){
singleBtn.title = nls.singleSort + ' - ' + nls.unsorted;
if(a11y){
singleBtn.innerHTML = a11yText.dojoxGridDescending;
}
singleBtn.innerHTML = a11yText.dojoxGridDescending + '&nbsp;';
}else{
nestedBtn.title = nls.nestedSort + ' - ' + nls.unsorted;
if(a11y){
nestedBtn.innerHTML += a11yText.dojoxGridDescending;
}
nestedBtn.innerHTML += a11yText.dojoxGridDescending;
}
}else{
addClass(cell, 'gridxCellSortedAsc');
if(len == 1){
singleBtn.title = nls.singleSort + ': ' + nls.descending;
if(a11y){
singleBtn.innerHTML = a11yText.dojoxGridAscending;
}
singleBtn.innerHTML = a11yText.dojoxGridAscending + '&nbsp;';
}else{
nestedBtn.title = nls.nestedSort + ' - ' + nls.descending;
if(a11y){
nestedBtn.innerHTML += a11yText.dojoxGridAscending;
}
nestedBtn.innerHTML += a11yText.dojoxGridAscending;
}
}
}
Expand Down
9 changes: 2 additions & 7 deletions modules/filter/FilterBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ define([
"dojo/dom-construct",
"dojo/dom-attr",
"dojo/dom-class",
"dojo/hccss",
"dojo/string",
"dojo/parser",
"dojo/query",
Expand All @@ -29,7 +28,7 @@ define([
"dojo/query",
"dojo/parser"

], function(dojo, dijit, declare, lang, array, event, dom, domAttr, css, has, string, parser, query, _Module, template, locale, Filter, FilterDialog, FilterConfirmDialog, FilterTooltip){
], function(dojo, dijit, declare, lang, array, event, dom, domAttr, css, string, parser, query, _Module, template, locale, Filter, FilterDialog, FilterConfirmDialog, FilterTooltip){

/*=====
var columnDefinitionFilterMixin = {
Expand Down Expand Up @@ -151,16 +150,12 @@ define([
this.connect(this.domNode, 'onmousemove', 'onDomMouseMove');
this.connect(this.domNode, 'onmouseout', 'onDomMouseOut');
this.loaded.callback();

if(has('highcontrast')){
query('.gridxFilterBarCloseBtn', this.domNode)[0].innerHTML = 'x';
}
},
onDomClick: function(e){
if(!e.target || !e.target.tagName){return;}
if(domAttr.get(e.target, 'action') === 'clear'){
this.clearFilter();
}else if(css.contains(e.target, 'gridxFilterBarCloseBtn')){
}else if(css.contains(e.target, 'gridxFilterBarCloseBtn') || css.contains(e.target,'gridxFilterBarCloseBtnText')){
this.hide();
}else {
this.showFilterDialog();
Expand Down
6 changes: 2 additions & 4 deletions modules/filter/FilterTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ define([
"dijit",
"dojo/_base/declare",
"dojo/string",
"dojo/hccss",
"dojo/i18n!../../nls/FilterBar",
"./Filter",
"./FilterDialog",
"dijit/TooltipDialog",
"dijit/popup",
"dijit/Tooltip",

"dojo/_base/array",
"dojo/_base/event",
"dojo/_base/html"
], function(dojo, dijit, declare, string, has, i18n){
], function(dojo, dijit, declare, string, i18n){

return declare(dijit.TooltipDialog, {
//summary:
Expand Down Expand Up @@ -63,7 +61,7 @@ define([
'<div>',
fb._getRuleString(d.condition, d.value, d.type),
'<span action="remove-rule" title="${i18n.removeRuleButton}"',
' class="gridxFilterTooltipRemoveBtn">' + (has('highcontrast') ? 'x':'') + '</span></div></td></tr>');
' class="gridxFilterTooltipRemoveBtn"><span class="gridxFilterTooltipRemoveBtnText">x</span></span></div></td></tr>');
}, this);
arr.push('</table>');
this.i18n = i18n;
Expand Down
8 changes: 8 additions & 0 deletions resources/Dod.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,12 @@

.gridxDodShown .gridxDodExpando {
background-position: -380px -20px;
}

.gridxDodExpandoText {
display: none;
}

.dijit_a11y .gridxDodExpandoText {
display: inline;
}
10 changes: 10 additions & 0 deletions resources/filter.css
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,13 @@
.gridxQuickFilterHasFilterBar .gridxQuickFilterButton {
display: none;
}

.gridxFilterBarCloseBtnText,
.gridxFilterTooltipRemoveBtnText {
display: none;
}

.dijit_a11y .gridxFilterBarCloseBtnText,
.dijit_a11y .gridxFilterTooltipRemoveBtnText {
display: inline;
}
7 changes: 6 additions & 1 deletion resources/sort.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ th.gridxCellSortFocus.gridxCellSortedDesc .gridxSortBtnNested {
}



.gridxNestedSortBtnText {
display: none;
}
.dijit_a11y .gridxNestedSortBtnText {
display: inline;
}


2 changes: 1 addition & 1 deletion templates/FilterBar.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
title: '${defineFilter}'" aria-label='${defineFilter}'
/><div class="gridxFilterBarStatus"
><span>${noFilterApplied}</span
><span class="gridxFilterBarCloseBtn" tabindex="-1" title="${closeFilterBarBtn}"></span
><span class="gridxFilterBarCloseBtn" tabindex="-1" title="${closeFilterBarBtn}"><span class="gridxFilterBarCloseBtnText">x</span></span
></div>
4 changes: 2 additions & 2 deletions tests/test_grid_alwaysEditing.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1 class='title' tabindex='0' onfocus='this.style.color="blue"' onblur='this.st
Grid AlwaysEditing Test
</h1>
<h2>Test Grid1: narrow rows</h2>
<div jsid='grid1' data-dojo-type='gridx/Grid' data-dojo-props='
<div jsid='grid1' data-dojo-type='gridx.Grid' data-dojo-props='
cacheClass: "gridx/core/model/cache/Sync",
store: store1,
structure: layout1,
Expand All @@ -34,7 +34,7 @@ <h2>Test Grid1: narrow rows</h2>
]
'></div>
<h2>Test Grid2: tall rows</h2>
<div jsid='grid2' data-dojo-type='gridx/Grid' data-dojo-props='
<div jsid='grid2' data-dojo-type='gridx.Grid' data-dojo-props='
cacheClass: "gridx/core/model/cache/Sync",
store: store2,
structure: layout2,
Expand Down
Loading

0 comments on commit 277bbd3

Please sign in to comment.