The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Expand/Collapse button not working for rows
I have put expand/collapse code for table by following direction from vbulletin manual.
Code is working for only first row title link. when I click on second row link same first row is collapsing and expanding. Can anybody please help me on how to write code for expand/collapse for each individual row. I also want first row to be expanded by default and all other rows user can click on it to expand/collapse. Here is my code i wrote working for only first row. ----------------------------------------------------------------------------------------- <tr><td class="thead"> <a href="#top" style="float:$stylevar[right]" onclick="return toggle_collapse('categ')"><img id="collapseimg_categ" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_categ].gif" alt="" border="0" /></a> <a href="$cat[caturl]">$cat[title]</a></td></tr> <tbody id="collapseobj_categ" style="$vbcollapse[collapseobj_categ]"> <tr><td>$cat[description]</td></tr> </tbody> ------------------------------------------------------------------------------------------ Please help me where am i missing to expand/collapse properly. I wasted 2 days already figuring out. If anybody can help me, I will really appreciate. Thanks in advance |
#2
|
||||
|
||||
Your IDs have to be different for each individual row.
Row 1 categ1 Row 2 categ2 Row 3 categ3 etc. |
#3
|
|||
|
|||
Thanks for your reply. The same code (title) will display all of rows from database with different $cat[title]. Then where should I change the ID. The below code is in my (module-template) in style manager and I have 1 php page calling that template I guess in the module. Can you please guide me through where I should add different ID's.
Right now with below code . Even when I click on 2nd title first title is expanding/collapsing. Do I need to create a new page for object-collapse <tr><td class="thead"> <a href="#top" style="float:$stylevar[right]" onclick="return toggle_collapse('categ')"><img id="collapseimg_categ" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_categ].gif" alt="" border="0" /></a> <a href="$cat[caturl]">$cat[title]</a></td></tr> <tbody id="collapseobj_categ" style="$vbcollapse[collapseobj_categ]"> <tr><td>$cat[description]</td></tr> </tbody> Please provide some suggestions. Thanks in advance --------------- Added [DATE]1193723154[/DATE] at [TIME]1193723154[/TIME] --------------- I searched in forums for expand/collapse, I am understanding that we have to use array's. since it is in same loop to get different id's on fly. I figured we have to use array element. Can any one please provide me some example code for array collapsing to get different id's for each title when it loops through the code. FYI- with below code only first row(title) is expanding/collapsing when we click on any 6 rows(titles) ----------------------------------------------------------------------------------------- <thead> <tr><td class="thead"> <a href="#top" style="float:$stylevar[right]" onclick="return toggle_collapse('categ')"><img id="collapseimg_categ" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_categ].gif" alt="" border="0" /></a> <a href="$cat[caturl]">$cat[title]</a></td></tr> </thead> <tbody id="collapseobj_categ" style="$vbcollapse[collapseobj_categ]"> <tr><td>$cat[description]..date etc..</td></tr> </tbody> ------------------------------------------------------------------------------------------ I really appreciate any kind of help on this Thanks |
#4
|
||||
|
||||
Try this. It assumes you have an id column in the category table. If the field is called something else, substitute it.
Code:
<tr><td class="thead"> <a href="#top" style="float:$stylevar[right]" onclick="return toggle_collapse('categ$cat[id]')"><img id="collapseimg_categ$cat[id]" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_categ$cat[id]].gif" alt="" border="0" /></a> <a href="$cat[caturl]">$cat[title]</a></td></tr> <tbody id="collapseobj_categ$cat[id]" style="$vbcollapse[collapseobj_categ$cat[id]]"> <tr><td>$cat[description]</td></tr> </tbody> |
#5
|
|||
|
|||
Thanks for reply. When I used with catid. I am getting following error Parse error: parse error,
unexpected T_VARIABLE, expecting ']' in C:\Program Files\EasyPHP 2.0b1\www\upload\includes\adminfunctions_template. php(3596) : eval()'d code on line 9 I think it is not liking 'categ$cat[id]. inside[] brackets. Do you know anything that we can fix this error. I appreciate your help. --------------- Added [DATE]1193761815[/DATE] at [TIME]1193761815[/TIME] --------------- Thanks a lot for your help. Expand/collapse working now. I took out [] for image and object section it came out with no errors. Only thing now is all are in exapand mode. I wanted only first link to be expanded all others to be collapsed.User can select to expand. Is there a way to set like that for first row to be always expanded? I really appreciate your help.You saved my time. |
#6
|
|||
|
|||
How did you set something to be collapsed by default?
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|