I am experimenting some more with bootstrap and d3.js and trying to 
understand how
to add more graphs to this menu. I was able to get two different views 
working by using the LOAD
helper. The following things are either not working or I would like some 
more explanation about what could be wrong. Any help is very much 
appreciated.

1. If I swap the contents of the first two divs, id=1, id=2, the graph will 
not load in the 2nd div.  What could be causing this? I don't see any 
errors in the web console about something not loading or found.

2. The 3rd div does not load at all. I can separately load the path to the 
html and this
shows up fine, /enp6/p7days/pweek, but from this menu below it does not 
work, even
though the controller is set up exactly like that of div id=1. Any hints on 
how to get multiple graphs to work using LOAD with this bootstrap menu?

3. Div id=2 uses a different js library, whereas div id's 1 & 3 are using 
the same
js library. Does that make any difference if two script/html are using the 
same
library? D3 is very fun to work with, btw. 

thanks,

Margaret  

{{response.files.append(URL('enp6','static','dygraphjs/excanvas.js'))}}
{{response.files.append(URL('enp6','static','dygraphjs/dygraph-dev.js'))}}
{{extend 'layout.welcome.html'}}  <!-- this is the outside menu -->
{{left_sidebar_enabled = globals().get('left_sidebar_enabled',True)}}

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<title>Example tabable nav with Twitter Bootstrap</title> 
<meta name="description" content="Example tabable nav with Twitter 
Bootstrap">
<link href="../static/assets/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<div class="container" width="100%">
<row class="span9">
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#1" data-toggle="tab">Today's Energy</a></li>
<li class=""><a href="#2" data-toggle="tab">Power Production</a></li>
<li class=""><a href="#3" data-toggle="tab">Past Seven Days</a></li>
<li class=""><a href="#4" data-toggle="tab">This Month's Energy</a></li>
<li class=""><a href="#5" data-toggle="tab">Test section</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="1">
{{=LOAD(c='addstats', f='sumstats') }} 

</div> <!-- end of section 1 -->

<div class="tab-pane" id="2">
<!--<p>Content section 2</p> -->
 <!-- CONTENT -->
<p>
    {{if 'watts' in globals(): }}
    <h3> {{=watts.tenergy}} W </h3>
    <h6> Today's Peak {{=watts.tenergy}} W </h6>
    
    {{pass }}
 </p>

{{=LOAD('default', 'sparkline') }} 
<!--  <h3> Sparkline content above this </h3> -->

</div> <!--end of section 2 -->

<div class="tab-pane" id="3">
<p>Content Section 3.</p>
{{=LOAD(c='p7days', f='pweek') }} 

</div>

<div class="tab-pane" id="4">
<p>Content  Section 4.</p>
</div>
<div class="tab-pane" id="5">
<p>Content  Section 5.</p>
<div>
<p>
     {{=watts}} 
      <h3> 
      {{pass}}
</div>
 </p>
</div>
</div>
</div>
</div>
</div>
<script src="../static/assets/js/jquery.js"></script>
<script src="../static/assets/js/bootstrap-tab.js"></script>
</body>
</html>


On Wednesday, May 29, 2013 10:08:45 AM UTC-5, Niphlod wrote:
>
> uhm. a function defined in a controller is not available "globally". it's 
> a mere "structure" to have something that "replies" to a request.
> why can't you "move" that controller function to models ?
> I mean....
>
> in a controller you have
> def yourfunction():
>       return 'a'
>
>
> but in the menu you can't "fetch" that easily.
> The first thing that comes to mind is putting that function in a model, so
> def yourfunction_helper():
>     return 'a'
>
>
> in your menu is now simple to fetch the result, and in your controller you 
> can do
> def yourfunction():
>      return yourfunction_helper()
>
>
>
>
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to