2012-07-25 4 views
1

Google 스크립트 사용 HTML 테이블이있어서 정렬 가능한 열을 만들고 싶습니다.Google 스크립트에서 정렬 가능한 html 테이블 만들기

sortable 또는 tablesorter jQuery 플러그인에서이 작업을 수행하는 방법이 있나요? 내 자신의 공용 서버에서 호스팅하지 않고 호출하는 방법을 볼 수 없기 때문에 js 폴더에 포함시킬 방법이 없습니다. Google Scripts?

답변

1

Google 스크립트를 사용 중이므로 Default Services을 통해 Google 시각화 API를 사용할 수 있습니다. 여기에는 묻는 결과를 얻을 수있는 TableChartBuilder이 포함됩니다.

여기 an example은 차트를 게시하는 방법을 설명하는 Visualize Your Data: Charts in Google Apps Script!의 차트 예제를 기반으로합니다.

function doGet() {  
    // Populate the DataTable. We'll have the data labels in 
    // the first column, "Release", and then add two data columns, 
    // for "Income" and "Expenses" 
    var dataTable = Charts.newDataTable()  
     .addColumn(Charts.ColumnType.STRING, "Release")  
     .addColumn(Charts.ColumnType.NUMBER, "Income")  
     .addColumn(Charts.ColumnType.NUMBER, "Expenses")  
     .addRow(["1.0", 60, 55])  
     .addRow(["10.2", 50, 60])  
     .addRow(["2.10", 100, 50]) 
     .addRow(["12.0.1", 70, 60])  
     .addRow(["2.0.0.142", 30, 50]) 
     .addRow(["2.0.0.1_2", 114, 75]) 
     .build(); 

    // Build the chart. 
    var chart = Charts.newTableChart() 
     .setDataTable(dataTable) 
     .build(); 

    // Add our chart to the UI and return it so that we can publish 
    // this UI as a service and access it via a URL. 
    var ui = UiApp.createApplication(); 
    ui.add(chart); 
    return ui; 
} 
관련 문제