From 3852cb8115aa8f71eafbcf053fe47977a4e0c532 Mon Sep 17 00:00:00 2001 From: Beomki Lee Date: Thu, 31 May 2012 20:09:00 +0900 Subject: [PATCH] * bug in firefox solved using 200ms setTimeout (still don't know the exact reason) --- css/basic.css | 2 +- iframe.html | 1 + js/example.js | 32 ++++++++++++++++++++++++++------ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/css/basic.css b/css/basic.css index a2bbd46..895a9b0 100755 --- a/css/basic.css +++ b/css/basic.css @@ -1,6 +1,6 @@ /* page styles */ body { font-family: "Segoe UI", Frutiger,Tahoma,Helvetica,"Helvetica Neue", Arial, sans-serif; } -table { border-collapse: collapse; display: none; } +table { border-collapse: collapse; } td, th { text-align: center; border: 1px solid #ddd; diff --git a/iframe.html b/iframe.html index 04eff02..ed61674 100644 --- a/iframe.html +++ b/iframe.html @@ -12,5 +12,6 @@ + diff --git a/js/example.js b/js/example.js index ef8eb74..c1d209f 100755 --- a/js/example.js +++ b/js/example.js @@ -32,10 +32,27 @@ $(function(){ href: "css/visualize-dark.css" }).appendTo("head"); } - $('#input_table', window.parent.document).clone().appendTo('body'); + + graph_or_table = 0; + + $('#input_table', window.parent.document).clone().prependTo('body'); $('thead th:last-child').remove(); $('tbody td:last-child').remove(); $('tbody tr:last').remove(); + $('input').click(function(){ + if(graph_or_table == 0){ + $('table').show(); + $('.visualize').hide(); + graph_or_table = 1; + $('input').val('See it in graph'); + } + else{ + $('table').hide(); + $('.visualize').show(); + graph_or_table = 0; + $('input').val('See it in table'); + } + }); $('caption, th, td').each(function(){ i = $(this).find('input'); v = i.val(); @@ -43,9 +60,12 @@ $(function(){ p.empty(); p.text(v); }); - type = $.getUrlVar('type'); - if(type == 'pie'){ $('table').visualize({type: 'pie', parseDirection: $.getUrlVar('axis'), height: '300px', width: '420px'}); } - else if(type == 'bar'){ $('table').visualize({type: 'bar', parseDirection: $.getUrlVar('axis'), width: '420px'}); } - else if(type == 'area'){ $('table').visualize({type: 'area', parseDirection: $.getUrlVar('axis'), width: '420px'}); } - else{ $('table').visualize({type: 'line', parseDirection: $.getUrlVar('axis'), width: '420px'}); } + setTimeout(function(){ + $('#input_table').hide(); + type = $.getUrlVar('type'); + if(type == 'pie'){ $('#input_table').visualize({type: 'pie', parseDirection: $.getUrlVar('axis'), height: '300px', width: '420px'}); alert($('table').html()); } + else if(type == 'bar'){ $('#input_table').visualize({type: 'bar', parseDirection: $.getUrlVar('axis'), width: '420px'}); } + else if(type == 'area'){ $('#input_table').visualize({type: 'area', parseDirection: $.getUrlVar('axis'), width: '420px'}); } + else{ $('#input_table').visualize({type: 'line', parseDirection: $.getUrlVar('axis'), width: '420px'}); } + }, 200); });