Jump to content

table collapse expand underlying data


simpli

Recommended Posts

There's something I want to do and I don't know how to go about it.

I have several users who have made different choices in my database. I want to show the users, their total points and the detail of their points. The detail of their points is the hockey players they've chosen and whatever points these players have earned so far. I want to be able to collapse and expand that structure so we can see the details or revert back to a summary view. Can you tell me how  I should proceed to do this? Should I use a table with underlying cell? How do I handle the collapse expand part?

example of what I wanna do is below:

Thanks,

J-R

 

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/151508-table-collapse-expand-underlying-data/
Share on other sites

You will need a JavaScript function. You could probably add it to the on click event for the image and show hide the additional data :)

 

Here is a function you could use

 

function toggle(obj) {

document.getElementById(obj).style.display = (el.style.display != 'none' ? 'none' : '' );

}

That's interesting but what would I toggle? It seems I would have to toggle all the underlying rows of the table. Incidentally could I have a table where for each user you would have a div and each of these divs would contain the different rows and maybe I could toggle the div so I wouldn't have to toggle each row one at a time? Let me know and thanks for the help.

J-R

You could add slide behaviour to each element. Is there any type of js framework you are using? It doesn't really matter which one but any would make it a lot easier.

Thinking of which I just remembered that extjs has a demo that looks exactly like what you want.

 

http://extjs.com/deploy/dev/examples/desktop/desktop.html

click on "accordion window" and see what I mean

Hi, I saw the example you sent me to. It could do the work but in all honesty I'm a bit too newb to start working with frameworks. I intend to use dojo for my next project but this is my newbie project and I want to maybe keep it as plain vanilla as possible because it would probably take me a week to figure out how to use the framework.

Thanks,

J-R

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.