Мои данные:
Код: Выделить всё
[['RowId','State', 'Jan-24','Feb-24', 'Mar-24', 'Apr-24'
'oddheader', 'NY' 100, 200, 300, 400,
'oddchild','City - 1' 30, 50, 75, 100,
'oddchild','City - 2' 30, 50, 75, 150,
'oddchild','City - 3', 40, 100, 150, 150
'evenheader','IL', 500, 300, 345, 234
'evenchild','City-4', 500, 300, 345, 234]]
Свернуть таблицу Google Vis, когда содержимое строки скрыто.
HTML-код:< /p>
Код: Выделить всё
Toggle Odd
Toggle Even
Код: Выделить всё
google.charts.load('current', {'packages':['corechart','controls']});
google.charts.setOnLoadCallback(toogle_table);
function toogle_table(){
google.script.run.withSuccessHandler(e=>{
let arr_json = JSON.parse(e);
/* Creating Dynamic DataTable here - Pick only Column Names from the JSON because every month one month gets added */
_col_names = arr_json.shift(1);
_dtbl = new google.visualization.DataTable();
for(var i in _col_names){
if(_col_names[i] != 'RowId'){
if(i
Подробнее здесь: [url]https://stackoverflow.com/questions/79197846/collapsible-html-table-from-2d-array[/url]
Мобильная версия