PDA

View Full Version : Dynamic tables


claire rand
02-14-2005, 01:27 PM
Hi.

I've put this here, its a toss up between here and javascripting.. i chose here :-)

Currently I have a file containing a fair few rows of data, the source is XML with XSL controlling the display, applying a few conditional formats etc.

What i'm looking at is two fold..

firstly is there a way with sxl to pull out a list of unique values? something like the sort feature. Currently I've got round this by having a second data table of sorted values produced via Excel (I'm custom exporting the XML via a vba macro to avoid the garbage Excel adds to its files). But doing this on the fly would be helpful.

Secondly the table is being written out via a 'for-each' loop, what i'd like to be able to do is specify a few criteria at run-time, e.g. show everything where column 'x' is of value 'y' etc.

At design time this is easy but at run time its obviously a scripting thing, question is how can i *use* XML & XSL via javascript? I've had a look ont eh w3schools site, its good for javascript and xml, but doesn't meantion the link between the two.

I'm hoping to avoid having to manually process the file, and create a psudo table with 'div' elements and control the visibility manually, which will work but will not be pretty or easy to maintain.

I figured this has got to have cropped up before and was hoping someone had a link to some info on this sort of thing, or at least what its likely to be called.

Ta..

mpjbrennan
02-15-2005, 10:03 PM
Claire,

I played around with this sort of thing at one point. Have a look at the following:

http://www.patrick-brennan.com/xml/league_table.xml

patrick

claire rand
02-16-2005, 10:34 AM
this is indeed part of what me needs, the sorting side i've pretty much got running, the trick is the data selection at run time.

i've sort of done it before, using pretty inelegent code, but i was hoping there was an easier way of handling it than writing the whole table out, with each row as a seperate 'div' tag, then showing/hiding rows as required.

Dropping the whole table out works fine, its the selection..

While i can't fire the page online (comapny data, and i lack webspace here) what i'm trying to do is create a user freindly data page, with a limited search feature, ala 'show me all rows related to 'x' where 'x' is a variable displayed ina column