Results 1 to 3 of 3

Thread: Dynamic Tree grid in Extjs 4.1

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    8
    Vote Rating
    0
      0  

    Default 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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,061
    Answers
    3976
    Vote Rating
    1388
      0  

    Default

    For dynamic why don't you let it load the child nodes when you expand a node?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    8
    Vote Rating
    0
      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.

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
  •