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
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' : '' );

}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

I have a problem with the accordion as only one can be expanded at the same time. Is there an equivalent that would allow me to have several or all of the branches open or collapsed at a time?

 

Thanks for your continued help.

J-R

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.