1. #21
    Sencha User
    Join Date
    Mar 2012
    Location
    Oklahoma, USA
    Posts
    52
    Vote Rating
    8
    Answers
    10
    sdt6585 will become famous soon enough

      0  

    Default


    Nice, I'll have to dig into the templating features, I haven't had much need for them so far. Wish I could have pointed you in that direction in the first place, and thanks for sharing your solution.

  2. #22
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    88
    Vote Rating
    5
    Answers
    3
    whirling dervish is on a distinguished road

      0  

    Default


    No problem. Hope my solution is useful.

    Let me know if you find a way to handle sorting.

  3. #23
    Sencha User
    Join Date
    Jan 2013
    Posts
    2
    Vote Rating
    0
    H@v is on a distinguished road

      0  

    Default


    @whirling dervish

    i used your method to work arround in MVC way but no success i am not be able to build grid dynamically can you please tell me what is the MVC way. following is the code which i am using in my grid view widget in the initComponent function:

    var store = Ext.getStore('Routes');
    var maxStores = 0;
    store.load({
    callback: function(records, operation, success) {
    if (!success) {
    return;
    }
    Ext.Array.forEach(records, function(record) {


    var number = record.get('stores').length;
    if(number > maxStores) {
    maxStores = number;
    }
    });
    }
    });
    this.columns = [
    {
    text: 'id',
    dataIndex: 'routeID'
    },
    {
    text: 'Route Name',
    dataIndex: 'routeName'
    },
    {
    text:'CDC',
    renderer:function(v,m,r){
    return r.get('cdc').name;
    }
    }


    ];
    for (var i = 0; i < maxStores; i++) {
    var s = 'store ' + (i+1);
    this.columns.push({
    text: s,
    xtype: 'templatecolumn',
    sortable:true,
    tpl: '{[values.stores[' + i + '] ? values.stores[' + i + '].storeName : "" ]}'


    });
    }

  4. #24
    Sencha User
    Join Date
    Jun 2012
    Posts
    1
    Vote Rating
    0
    saurabh14august is on a distinguished road

      0  

    Default


    Hi,

    I am trying to do the same thing with a difference that i want to add checkcolumns dynamically.
    With template columns, its working fine but with checkcolumns, i am not able to specify the dataIndex and the header.

    Kindly help me with the same.



    Thanks,
    Saurabh