1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    18
    Vote Rating
    0
    charan@dev.com is on a distinguished road

      0  

    Post Unanswered: passing array of elements to Grid

    Unanswered: passing array of elements to Grid


    Team,

    I have two grids , in which one of the grid contains data loaded from db.

    On Cell click, I want to get the selected values of first grid and query them and display the result in second grid.

    I was successful in getting records into this array. How to pass this array to secondgridStore which was already loaded.

    var reqarr= new Array();
    reqarr=finalreq.split(',');
    alert(reqarr);

    var secondgriddata= {
    records:[
    for(i=0; i<reqarr.length;i++)
    {name:reqarr[i]}
    ]
    };

    secondgridStore.loadData(secondgriddata);

    It is showing error in Console(Syntax error in for loop).

    when I try like this
    var secondgriddata= {
    records:[

    {name:reqarr[0]},
    {name:reqarr[1]}
    ]
    };

    this results in success, but keeping static values is not good at all times right!!

    How to pass this array to Data records?

    Please help me out at earliest....

  2. #2
    Ext JS Premium Member twaindev's Avatar
    Join Date
    Sep 2009
    Posts
    223
    Answers
    15
    Vote Rating
    3
    twaindev is on a distinguished road

      0  

    Default


    Perhaps this sample helps:

    Code:
    Ext.onReady(function() {
        var panel = Ext.create('Ext.grid.Panel', {
            title: 'Test loadData',
            renderTo: Ext.getBody(),
            columns: [{
                text: 'Name',
                dataIndex: 'name',
                flex: 1
            }]
        }),
        array = 'Record A,Record B,Record C,Record D,Record E'.split(','),
        records = [],
        i = 0, ln = array.length;
    
        for(; i < ln; i+=1) {
            records.push({ name: array[i]});
        }
    
        panel.getStore().loadData(records);
    });
    Last edited by twaindev; 11 Oct 2011 at 5:21 AM. Reason: Prevent wrapping

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar