我正在使用Google Chart Tools在我的網頁上沿着Google Map顯示Table visulisation。當用戶點擊地圖位置時,回調會自動從表格中的位置列表中選擇相應的位置。Google Chart - setSelection不會滾動到Table visualization中的選定行
這可以正常工作,但表格不會自動滾動表格,因此選定的行是可見的(有很多點,因此只有有限的數量顯示在Table vis右側的滾動條上。 )
我看不到任何方式將視口的當前「位置」設置爲表格。有沒有辦法做到這一點?
謝謝!
代碼下面的代碼片段:
arrBuoyLocs = new google.visualization.DataTable();
vTable = new google.visualization.Table(document.getElementById('table_div'));
// do initialisation, etc...
.
.
.
function updateSelectedTableItem(buoyid) {
console.log('Searching for %s', buoyid);
idx = -1;
nRows = arrBuoyLocs.getNumberOfRows();
for(iRow = 0; iRow < nRows; iRow++) {
if(arrBuoyLocs.getValue(iRow, 0) == buoyid) {
console.log('Got match for %s at idx %d', buoyid, iRow);
idx = iRow;
break;
}
}
if(idx >= 0) {
vTable.setSelection([{row: idx, column: null}]);
// This highlights the row but does not show it if the row is
// scrolled off the screen. How do I scroll the Table to show
// the selected row?
}
}
一個明智的想法 - 我會在沒有任何其他選擇的情況下去做這件事!謝謝! – ccbunney 2012-11-14 20:58:56