Hi,
See inline

- VizBoy.

2009/4/3 [email protected] <[email protected]>

>
> well, i initiate the data object each time there is a new group. but
> what i wanna do is to filter all the tables simutanously.
> what i mean is that e.g. laptops, imacs and workstations got some
> things in common as the cpu clock. so, i want to filter all these
> tables by the cpu clock.
> how should i approach this problem?


One way to do it would be to keep an array of all relevant DataTables and
and another array of all relevant Tables. Then when you want to filter them,
iterate over them, find the proper column holding the cpu clock, and then
use the proper methods to filter them, and redraw. You can use a DataView
but you don't have to.


>
>
> what exactly am i doing wrong using the innerHTML property? well, the
> bug is fixed but its kinda ugly...


I don't think it's ugly at all to create the HTML divs separately from
creating the visualizations to draw in them.
But you could also do it differently.
Your bug was that innerHTML has problems with events, like I showed you in
my previous email.
What you could do is use other methods of creating divs.
For instance, instead of document.getElementById('foo').innerHTML =
document.getElementById('foo').innerHTML + '<div id="bar"> </div>';
you could write:
var newDiv = doucment.createElement('div');
newDiv.id = "bar";
document.getElementById('foo').appendChild(newDiv);

Or something along these lines.


>
>
> thank you
>
> On Mar 31, 3:18 pm, VizBoy <[email protected]> wrote:
> > We dug some more into your case.
> > Apparently, it's not a bug on our side, but rather, the way you use
> > innerHTML doesn't preserve events.
> > For instance, try this simple code:
> >
> > <html>
> > <head>
> > <script>
> > function g() {
> >  alert('g was called');
> >
> > }
> >
> > function f() {
> >    document.getElementById('foo').onclick = g;
> >    var inner = document.getElementById('bar').innerHTML;
> >    alert(inner);}
> >
> > </script>
> > <body onload="f();">
> > <div id="bar"> <div id="foo" style="width: 100px; height: 100px;
> > background-color: blue;"> </div> </div>
> > </body>
> > </html>
> >
> > You can see that the innerHTML doesn't mention the event handler on the
> > 'foo' div, but that the event handler is surely there (try clicking on
> it).
> > The way you use innerHTML destroys the event handlers.
> >
> > - VizBoy.
> >
> > 2009/3/30 [email protected] <[email protected]>
> >
> >
> >
> > > Hey VizBoy
> >
> > > first of all thank you for your support.
> > > but this workaround is kinda wierd... anyways, it works.
> >
> > > is it possible to filter across multipe tables with diffrent data, eg
> > > i want to filter the imac, the display and the laptops tables for
> > > their screen size. id like to do that in javascript as it minimizes
> > > xhr requests and simplifies my programm structure.
> >
> > > thanks again in advance for any help...
> >
> > > lukas
> >
> > > On Mar 28, 5:07 pm, VizBoy <[email protected]> wrote:
> > > > Hi,
> >
> > > > This looks like a bug on our side, with dynamically created tables on
> > > > dynamically created divs.
> > > > However, I found an easy workaround for you.
> > > > If you just create all divs before creating the tables, it should
> work
> > > fine.
> > > > In other words, take your line that goes:
> > > > get('list').innerHTML = get('list').innerHTML + '<h2>'
> > > +fulllist.group_name
> > > > + '</h2>' + '<div id="group'+ fulllist.id +'"></div>';
> >
> > > > out of the loop that creates the tables, and place it in a separate
> loop
> > > > that happens before the table-creating loop.
> >
> > > > I hope you understand and that it works. If not feel free to ask for
> > > > clarification.
> > > > Meanwhile, I've added this to our bug list.
> >
> > > > Regards,
> > > >    VizBoy.
> >
> > > > 2009/3/27 [email protected] <[email protected]>
> >
> > > > > I am sorry it took so long, but i was quite busy...
> >
> > > > > here is a html file which doesnt comunicate with php files:
> >
> > > > >http://clients.station.ch/hardwarelist/static.html
> >
> > > > > hope it helps
> >
> > > > > thank you
> >
> > > > > lukas
> >
> > > > > On Mar 24, 3:19 pm, VizBoy <[email protected]> wrote:
> > > > > > Hi,
> >
> > > > > > Browsers limit XHR (AJAX) requests to the same domain.
> > > > > > I would be glad to help you, as this might indeed be our bug.
> > > > > > But I need your help for that -- prepare me a page without php
> calls,
> > > > > only
> > > > > > javascript, that tries to recreate the problem. See if you can do
> > > that.
> > > > > Then
> > > > > > I can help you debug.
> >
> > > > > > As for filtering, what kind of filtering do you need? There are a
> few
> > > > > ways
> > > > > > to filter data -- you can filter data in the server side, or send
> > > another
> > > > > > query on the server upon the user clicking, etc... Please define
> > > exactly
> > > > > > what you are trying to do.
> >
> > > > > > Regards,
> > > > > >     VizBoy.
> >
> > > > > > 2009/3/24 [email protected] <[email protected]>
> >
> > > > > > > Thanks for your replys.
> >
> > > > > > > @ Максим Барбул:
> >
> > > > > > > changing the divs name didnt affect my script in any way.
> >
> > > > > > > @ VizBoy:
> >
> > > > > > > i did remove the eventhandler (which i need anyway) but didnt
> > > affect
> > > > > > > my issues either.
> >
> > > > > > > why cant you do it crossdomain? theres no restriction from my
> > > side...
> >
> > > > > > > there are two php scripts generating json:
> >
> > > > > > >http://clients.station.ch/hardwarelist/getfulllist.php
> >
> > > > > > > This is the json for the entire value entries.
> >
> > > > > > >http://clients.station.ch/hardwarelist/getgrouplist.php
> >
> > > > > > > And this one only outputs the json for the groups and their
> fields.
> >
> > > > > > > I'd really appreciate any help from your side. i feel kinda
> lost
> > > > > > > here...
> >
> > > > > > > i already know which will be my next problem: i will have to
> filter
> > > > > > > the table. i found this tutorial for this topic:
> >
> > >http://systemsbiology-visualizations.googlegroups.com/web/FilterDataT.
> > > > > ..
> >
> > > > > > > but how can i filter all the tables together?
> >
> > > > > > > thank you soooo much for your help
> >
> > > > > > > Lukas
> >
> > > > > > > On Mar 20, 5:46 pm, VizBoy <[email protected]> wrote:
> > > > > > > > This is indeed a strange behavior...
> > > > > > > > Two things I can suggest to you for now:
> > > > > > > > 1. Try seeing if it persists when you remove the event
> handlers
> > > on
> > > > > the
> > > > > > > sort.
> > > > > > > > 2. If you want me to help you debug, you have to send me a
> > > version
> > > > > > > without
> > > > > > > > calls to your php cause obviously I can't do them
> cross-domain..
> >
> > > > > > > > - VizBoy.
> >
> > > > > > > > On Fri, Mar 20, 2009 at 2:39 PM, [email protected] <
> >
> > > > > > > > [email protected]> wrote:
> >
> > > > > > > > > I could really need some help, i am lost with this problem
> and
> > > i
> > > > > have
> > > > > > > > > got no idea ho to fix this...
> > > > > > > > > Id really appreciate any help!
> >
> > > > > > > > > thanks
> >
> > > > > > > > > On Mar 19, 10:28 am, "[email protected]"
> > > > > > > > > <[email protected]> wrote:
> > > > > > > > > > Well, this is pure js, isnt it? It simply parses the JSON
> and
> > > > > creates
> > > > > > > > > > how can i give the object a diffrent name each time it is
> > > > > > > initialized?
> > > > > > > > > > Something like an iterator...
> > > > > > > > > > This is kinda wierd, that this doesnt work out of the
> box.
> >
> > > > > > > > > > Well i think it is easier to give you the link:
> > > > > > > > >http://clients.station.ch/hardwarelist/
> >
> > > > > > > > > > On Mar 18, 3:47 pm, VizBoy <[email protected]> wrote:
> >
> > > > > > > > > > > Please try to generate a simple pure-javascript
> example.
> > > > > > > > > > > There shouldn't be a problem with creating multiple
> tables.
> > > > > > > > > > > Try to give them different names, although I don't see
> the
> > > > > problem
> > > > > > > with
> > > > > > > > > > > giving them the same name.
> > > > > > > > > > > Anyway, once you have a working pure-javascript
> example, we
> > > can
> > > > > > > help
> > > > > > > > > you
> > > > > > > > > > > debug it.
> >
> > > > > > > > > > > Regards,
> > > > > > > > > > >     VizBoy.
> >
> > > > > > > > > > > On Wed, Mar 18, 2009 at 11:25 AM,
> > > [email protected] <
> >
> > > > > > > > > > > [email protected]> wrote:
> >
> > > > > > > > > > > > Someone got some ideas?
> >
> > > > > > > > > > > > On Mar 17, 4:46 pm, "[email protected]"
> > > > > > > > > > > > <[email protected]> wrote:
> > > > > > > > > > > > > I am parsing JSON generated by php. This is how i
> > > populate
> > > > > the
> > > > > > > > > table:
> >
> > > fulllist['groups'].each(function(fulllist,
> > > > > > > index){
> > > > > > > > > > > > >                         var data = new
> > > > > > > > > google.visualization.DataTable();
> > > > > > > > > > > > >                         groups = fulllist;
> >
> > > > > groups['fields'].each(function(field,
> > > > > > > > > index){
> > > > > > > > > > > > >                         data.addColumn('string',
> > > > > > > field.field_name);
> > > > > > > > > > > > >                         });
> > > > > > > > > > > > >                         data.addColumn('string',
> > > 'delete');
> > > > > > > > > > > > >                         if(groups['items'] !=
> null){
> >
> > > > > > > groups['items'].each(function(item,
> > > > > > > > > > > > rowindex){
> >
> > > data.addRows(1);
> >
> > > > > > > > > > > > item['values'].each(function(value, index){
> >
> > > > > > > > > data.setCell(rowindex,
> > > > > > > > > > > > index, value.value, '<span
> > > > > > > > > > > > > class="valueedit" id="valueedit_'+ value.value_id
> +'">'
> > > +
> > > > > > > > > value.value
> > > > > > > > > > > > > + '</span>');
> > > > > > > > > > > > >                                         });
> > > > > > > > > > > > >                                 });
> > > > > > > > > > > > >                         }
> > > > > > > > > > > > >                         data.sort([{column: 0}]);
> > > > > > > > > > > > >                         var table = new
> > > > > > > > > > > > google.visualization.Table(document.getElementById
> > > > > > > > > > > > > (fulllist.id));
> > > > > > > > > > > > >                         table.draw(data,
> > > {showRowNumber:
> > > > > false,
> > > > > > > > > > > > allowHtml: true});
> > > > > > > > > > > > >                 });
> >
> > > > > > > > > > > > > On Mar 17, 4:34 pm, rcrisman <[email protected]>
> > > wrote:
> >
> > > > > > > > > > > > > > Can you give us an example. and how are you
> > > generating
> > > > > the
> > > > > > > data.
> > > > > > > > >  PHP,
> > > > > > > > > > > > > > Java????
> >
> > > > > > > > > > > > > > On Mar 17, 11:26 am, "[email protected]"
> >
> > > > > > > > > > > > > > <[email protected]> wrote:
> > > > > > > > > > > > > > > hi
> > > > > > > > > > > > > > > I am generating multiple tables dynamically.
>  my
> > > > > problem is
> > > > > > > > > that only
> > > > > > > > > > > > > > > the last of these tables is sortable.
> > > > > > > > > > > > > > > how could i solve this problem? if it helps: i
> use
> > > the
> > > > > same
> > > > > > > > > name for
> > > > > > > > > > > > > > > the object each time i intialize the datatable.
> >
> > > > > > > > > > > > > > > thanks in advance
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to