5858 < h1 > Tableau Formatting Sample</ h1 >
5959 < button id ="initTableauButton " class ="btn btn-primary "> Click to Initialize the Extension</ button >
6060 < h2 class ="tableau-worksheet-title "> Subheader, using tableau-worksheet-title class</ h2 >
61- < text class ="tableau-worksheet "> Text, using worksheet class</ text >
61+ < text class ="tableau-worksheet "> Text, using tableau- worksheet class</ text >
6262 < h3 class ="tooltip-header "> Hover to see tooltip text, which is using tableau-tooltip class
6363 < span class ="tooltiptext tableau-tooltip "> Tooltip text, using tableau-tooltip class</ span >
6464 </ h3 >
@@ -77,13 +77,17 @@ <h3 class="tooltip-header">Hover to see tooltip text, which is using tableau-too
7777< script >
7878 $ ( "#initTableauButton" ) . click ( function ( ) {
7979 tableau . extensions . initializeAsync ( ) . then ( function ( ) {
80- console . log ( "Done!!! " ) ;
80+ console . log ( "initializeAsync finished " ) ;
8181 console . log ( tableau . extensions . dashboardContent . dashboard ) ;
82- console . log ( tableau . extensions . environment . workbookFormatting . formattingSheets ) ;
82+ if ( tableau . extensions . environment . workbookFormatting ) {
83+ console . log ( tableau . extensions . environment . workbookFormatting . formattingSheets ) ;
84+ $ ( '#initializeExtensionComment' ) . hide ( ) ;
85+ } else {
86+ $ ( '#initializeExtensionComment' ) . text ( 'Tableau formatting information for extensions is missing from this version of Tableau' ) ;
87+ }
8388 $ ( '#initTableauButton' ) . text ( 'Extension Initialized' ) ;
84- $ ( '#initializeExtensionComment' ) . hide ( ) ;
8589 } , function ( err ) {
86- console . log ( "Error!!! : " + err ) ;
90+ console . error ( "Error during initializeAsync : " + err ) ;
8791 } ) ;
8892 } )
8993 function toggleClassAndText ( newClass ) {
@@ -93,11 +97,11 @@ <h3 class="tooltip-header">Hover to see tooltip text, which is using tableau-too
9397 $ ( '#toggleFormattingButton' ) . text ( 'Currently ' + newClass + ' below' ) ;
9498 }
9599 $ ( '#toggleFormattingButton' ) . click ( function ( ) {
96- if ( $ ( '#toggleFormattingButton' ) . text ( ) . includes ( ' tableau-worksheet-title' ) ) {
97- toggleClassAndText ( ' tableau-dashboard-title' ) ;
100+ if ( $ ( '#toggleFormattingButton' ) . text ( ) . includes ( tableau . ClassNameKey . WorksheetTitle ) ) {
101+ toggleClassAndText ( tableau . ClassNameKey . DashboardTitle ) ;
98102 }
99103 else {
100- toggleClassAndText ( ' tableau-worksheet-title' ) ;
104+ toggleClassAndText ( tableau . ClassNameKey . WorksheetTitle ) ;
101105 }
102106 } )
103107</ script >
0 commit comments