Results 1 to 7 of 7

Thread: A bug in Ext.grid.PivotAxis

Hybrid View

Previous Post Previous Post   Next Post Next Post
    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default 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);
    }
    ..

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,411
    Vote Rating
    1290
      0  

    Default

    Can I get a test case to reproduce an issue?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default 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

  4. #4
    Sencha User
    Join Date
    Nov 2010
    Posts
    4
    Vote Rating
    0
      0  

    Default 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>

  5. #5
    Sencha User
    Join Date
    May 2013
    Posts
    2
    Vote Rating
    0
      0  

    Default 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

  6. #6
    Sencha User
    Join Date
    Apr 2011
    Posts
    3
    Vote Rating
    0
      0  

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •