如何在點擊事件後繪製數據表? 我旁邊的js代碼:如何在點擊事件後繪製google.visualization.datatable?
function drawDataTable() {
var options = {'showRowNumber': true};
var query = new google.visualization.Query($('#connection_spreadsheet_url').val());
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
(new google.visualization.Table($('#table')[0])).draw(data, options);
}
function sendAndDraw() {
query.send(handleQueryResponse);
}
google.setOnLoadCallback(sendAndDraw);
}
它的做工精細,但我想只有在點擊按鈕後,繪圖數據表(例如$( '#鍵'))
非常感謝您! 漂亮而簡單的解決方案! – MicRum