Wait! Looks like we don't have enough information to add this to bug database. Please follow this
template bug format.
-
Sencha User
A bug in Ext.grid.PivotAxis
I found a bug in the method buildHeaders of Ext.grid.PivotAxis. Look at the following code snapshot:
/* * 'changed' indicates that we need to create a new cell. This should be true whenever the cell * above (previousHeader) is different from this cell, or when the cell on the previous dimension * changed (e.g. if the current dimension is Product and the previous was Person, we need to start * a new cell if Product is the same but Person changed, so we check the previous dimension and tuple) */ changed = previousHeader != undefined && previousHeader != currentHeader; if (i > 0 && j > 0) { changed = changed || tuple.data[dimensions[i-1].dataIndex] != tuples[j-1].data[dimensions[i-1].dataIndex]; }
I think it is not enough just to check previous dimension. Instead all the preceding dimensions should be compared. So my fix is like below:
isPrecedingChanged : function(tuples,dimensions,currentCol,currentRow){
var changed = false;
for(var col= currentCol; col>0; col--){
if(tuples[currentRow].data[dimensions[col-1].dataIndex]!=tuples[currentRow-1].data[dimensions[col-1].dataIndex]){
changed = true;
break;
}
}
return changed;
},
…..
changed = previousHeader !== undefined && previousHeader != currentHeader;
if (i > 0 && j > 0) {
changed = changed || me.isPrecedingChanged(tuples,dimensions,i,j);
}
…..
-
Can I get a test case to reproduce an issue?
-
Sencha User
test data
AA |
BB |
CC |
DD |
EE |
FF |
Estimated Sales |
Actual Sales |
V1 |
Shanghai |
1 |
Finance |
Special Finance |
Hank |
8888 |
2222 |
V2 |
Beijing |
1 |
Finance |
Special Finance |
Adam |
7878 |
111 |
V2 |
Boston |
1 |
Finance |
Special Finance |
Adam |
3333 |
4343 |
V2 |
Boston |
1 |
Finance |
Special Finance |
Apple |
7878 |
7676 |
-
Sencha User
Here comes a testcase
put following html file in examples\grid folder. you will see misalignment.
<!DOCTYPE HTML>
<html>
<head>
<title>Test Page</title>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<!-- EID Theme CSS -->
<!-- ** CSS ** -->
<!-- base library -->
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<!-- overrides to base library -->
<!-- page specific -->
<link rel="stylesheet" type="text/css" href="../shared/examples.css" />
<link rel="stylesheet" type="text/css" href="grid-examples.css" />
<!-- ** Javascript ** -->
<!-- ExtJS library: base/adapter -->
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<!-- ExtJS library: all widgets -->
<script type="text/javascript" src="../../ext-all-debug.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
var SaleRecord = Ext.data.Record.create([
{name: 'D1', type: 'string'},
{name: 'D2', type: 'string'},
{name: 'D3', type: 'string'},
{name: 'D4', type: 'string'},
{name: 'D5', type: 'string'},
{name: 'D6', type: 'string'},
{name: 'D7', type: 'string'},
{name: 'D8', type: 'string'},
{name: 'M1', type: 'int'}
]);
var myData = [
{"id":"1","D1":"V1","D2":"Shanghai","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Hank","D7":"aa","D8":"d81","M1":"8888"},
{"id":"2","D1":"V1","D2":"Shanghai","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Hank","D7":"aa","D8":"d80","M1":"8887"},
{"id":"3","D1":"V1","D2":"Shanghai","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Hank","D7":"aa","D8":"d87","M1":"8886"},
{"id":"4","D1":"V2","D2":"Beijing","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Adam","D7":"ab","D8":"d86","M1":"7878"},
{"id":"5","D1":"V2","D2":"Beijing","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Adam","D7":"ac","D8":"d85","M1":"7878"},
{"id":"6","D1":"V2","D2":"Beijing","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Adam","D7":"ab","D8":"d84","M1":"7878"},
{"id":"7","D1":"V2","D2":"Beijing","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Adam","D7":"ab","D8":"d82","M1":"7878"},
{"id":"8","D1":"V2","D2":"Boston","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Adam","D7":"ac","D8":"d81","M1":"3333"},
{"id":"9","D1":"V2","D2":"Boston","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Adam","D7":"er","D8":"d34","M1":"3333"},
{"id":"10","D1":"V2","D2":"Boston","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Apple","D7":"df","D8":"d80","M1":"7878"},
{"id":"11","D1":"V2","D2":"Boston","D3":"1","D4":"Finance","D5":"Special Finance","D6":"Apple","D7":"df","D8":"d55","M1":"7878"}
];
// A simple store that loads SaleRecord data from a url
var myStore = new Ext.data.Store({
autoLoad: true,
proxy : new Ext.data.MemoryProxy(myData),
reader: new Ext.data.JsonReader({
}, SaleRecord),
});
// Create the PivotGrid itself, referencing the store
var pivot = new Ext.grid.PivotGrid({
title: 'PivotGrid example',
store : myStore,
aggregator: 'sum',
measure : 'M1',
renderTo : Ext.getBody(),
viewConfig: {
title: 'Sales Performance'
},
leftAxis: [
{
width: 60,
dataIndex: 'D1'
},
{
width: 150,
dataIndex: 'D2'
},
{
width: 60,
dataIndex: 'D3'
},
{
width: 60,
dataIndex: 'D4'
},
{
width: 60,
dataIndex: 'D5'
},
{
width: 60,
dataIndex: 'D6'
}
],
topAxis: [
{
dataIndex: 'D7'
},
{
dataIndex: 'D8'
}
]
});
});
</script>
</head>
<body>
</body>
</html>
-
Sencha User
Do you need more info to sub,it a bug?
I am just following up on the issue described by Hank. Do you need more info to submit a bug? or has a bug already been filed? Thanks.
Bill
-
Sencha User
We are also experiencing the same bug as described by wuxi7227.
I can confirm that the code sample provided by wuxi7227 correctly reproduces the bug.
Please advise if you have sufficient information to submit this bug.
-
Sencha User
Ticket has been filed
I went ahead and submitted a ticket for this:
https://support.sencha.com/index.php#ticket-12688
Bill