javascript 里面往数组添加数组值

 

javascript 里面往数组添加数组值。

unshift最开始添加数组值:

data2.unshift(new Array('Toptoubu'));

push结尾的地方添加数组值:

data2.push(new Array('abc'));

------------------------------------------------------------------

this._stoSection = new Ext.data.ArrayStore({
            fields: ['Section']
        });
        TAAjax.request({
            url: '101.ashx',
            params: { action: 'getSection' },
            success: function (req, ops) {
                var data = eval('(' + req.responseText + ')');
                var data2 = new Array(data.length + 1);
                data2[0] = new Array("");
                for (i = 0; i < data.length; i++) {
                    var data3 = new Array(1);
                    data3[0] = data[i];
                    data2[i + 1] = data3;
                };
                data2.push(new Array('abc'));
                this._stoSection.loadData(data2);
            },
            scope: this
        });

 

--------------------------------------------------------------------

posted @ 2016-04-18 15:49  iDennis  阅读(1902)  评论(0编辑  收藏  举报