1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    8
    Vote Rating
    0
    madhav.msd is on a distinguished road

      0  

    Default Unanswered: Dynamic Tree grid in Extjs 4.1

    Unanswered: Dynamic Tree grid in Extjs 4.1


    Hi All,

    Kindly requesting for help to make the dynamic grid add and remove execution faster. I'm having a tree grid, which has 4 static columns and after that, some dynamic columns based on the hasMany relationship data in the store.

    I can able to get the grid work, but it is taking more than 3 mins to render the data. Here is my code below, and request your help to make the code execute faster(very urgent). And the data will be available only in the leaf node.

    // removing the column if there is any dynamic column added
    function removeColumnsIfExists(){
    var headerCols=grid.getView().getGridColumns();
    for(var i=4; i<headerCols.length; i++){
    grid.headerCt.remove(i);
    }
    grid.getView().refresh();
    }

    // creating dynamically new column to display the date field

    function createFlatStore_1(node){
    removeColumnsIfExists();
    if(node){
    if(node.hasChildNodes()){
    var children=node.childNodes;
    for(var i=0;i<children.length;i++){

    if(children[i].isLeaf()){

    var columns = children[i].myDates();

    for(var j=0;j<columns.count();j++){
    column = Ext.create('Ext.grid.column.Date', {
    dataIndex:'dataIndex'+j,
    text: columns.getAt(j).get('title'),
    format:'d/m/Y',
    align: 'center',
    editor: {
    xtype: 'monthfield',
    allowBlank: false,
    format : 'd-M-Y'
    },
    renderer : function (value, metaData, record, row, col, store, gridView){
    var pgms=record.myDates();
    var dateValue;
    if(pgms.count() > (col-4)) {
    if(value !== undefined){
    pgms.getAt(col-4).set('date', value);
    pgms.getAt(col-4).setDirty();
    }
    dateValue = Ext.Date.dateFormat(pgms.getAt(col-4).get('date'),'d-M-Y');

    }
    return dateValue;
    }
    });

    grid.headerCt.insert(grid.columns.length, column);
    grid.getView().refresh();
    }

    break;
    }

    createFlatStore_1(children[i]);
    }

    }
    }
    }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,525
    Vote Rating
    872
    Answers
    3564
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    For dynamic why don't you let it load the child nodes when you expand a node?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    Sep 2012
    Posts
    8
    Vote Rating
    0
    madhav.msd is on a distinguished road

      0  

    Default


    Thanks mitchellsimoens, for your response

    By default all my nodes are expanded. And also for parent nodes the associated data length is zero. Only the leaf node will have the data.

Thread Participants: 1

Tags for this Thread