You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/01/21 13:01:08 UTC

[GitHub] [incubator-superset] PRamia commented on issue #8705: Table th bug when switch Tabs

PRamia commented on issue #8705: Table th bug when switch Tabs
URL: https://github.com/apache/incubator-superset/issues/8705#issuecomment-576670469
 
 
   Hi guys,
   
   this bug persists, and i hope that the developers fix it soon.
   
   Anyway, i found a working solution just adding a script into the superset javascript file. In my case i am using the docker version (docker-compose), so in my case i go first into the Superset Docker container with:
   
   $ docker ps
   $ docker exec -ti --user root yourContainerID bash 
   
   once there we'll need a text editor, like vim, so install it there:
   $ apt-get update
   $ apt-get upgrade
   $ apt-get install vim
   
   then navigate to the folder /usr/local/lib/python3.6/site-packages/superset/static/assets/dist/
   $ cd cd /usr/local/lib/python3.6/site-packages/superset/static/assets/dist/
   
   check the existing files:
   
   $ ls
   
   the javascript files there have kind of random generated names, so in my case i edit the file 37.6a8767f3d3757c9b0f62.chunk.js
   
   $ vim 37.6a8767f3d3757c9b0f62.chunk.js
   
   Once there are this code on the top of the existing code:
   
   `$(document).ready(function() {
       console.log('Custom Script running... ')
   
   var tabs = window.document.querySelectorAll('[role="tab"]');
   
       let myFunction = function() {
           setTimeout(() => {
               for (i = 0; i < window.document.getElementsByClassName('dataTables_scrollHead').length; i++) {
                   window.document.getElementsByClassName("dataTables_scrollHead")[i].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.querySelectorAll('[role="menuitem"]')[0].click()
               }
           }, 200)
       };
   
       for (var i = 0; i < tabs.length; i++) {
           tabs[i].addEventListener('click', myFunction, false);
       }
   });`
   
   This code just adds an event listener to every tab "button", so when it is clicked, a function looks for every table and refreshes it. 
   
   A bad hack, i know, but at least it works.
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org