-1
而不是「Item 1」等,我想把我自己的數據放入extjs的可滾動菜單下拉列表中,然後發送值以查詢相應的頁面。這裏的ExtJS的菜單上的文檔:什麼是最好的方式把js數組放入extjs滾動菜單
var scrollMenu = new Ext.menu.Menu();
for (var i = 0; i < 50; ++i){ // replace this loop with one that loops thru my data
scrollMenu.add({
text: 'Item ' + (i + 1), // replace this with text from array (see my data below)
id: // replace this with number from array (see my data below)
});
}
// scrollable menu
tb.add({
icon: 'preview.png',
cls: 'x-btn-text-icon',
text: 'Scrolling Menu',
menu: scrollMenu
});
View an online sample並單擊菜單中的「滾動菜單」按鈕。
這是我的數據:
var locations = [
[23, 'Main Room'],
[1, 'Main Lobby'],
[2, 'Training Room'],
[56, 'Main Office'],
[57, 'Lower Office'],
[9, 'Lower Lobby'],
[62, 'Conference Room'],
[22, 'Outdoor Patio'],
[63, 'Upper Lobby']
];
我對這個建議沒有任何運氣。我在項目[0]後面添加了一個逗號,並在新的Ext.menu.Menu前添加了「var scrollMenu =」({ – sloga