Jump to content

Collapsible Sets Of Check Boxes?


Recommended Posts

Posted

So I have xplode up and running and I really like the checkbox mode. I was wondering if it were possible to make it so different sets of check boxes were hideable...cuz after you get a bunch of stuff in there it starts to become unwieldy...

I know how to do this with DHTML, but I don't really understand how html/javascript works with xplode...like, can I just go editing the html files that came with it and expect that to work?

-eMpTy


Posted

Try it and see.

All the selection plugin is doing is embedding an IE window, so DHTML stuff should work fine.

The ones included were only hacked together, so it's as basic as I could make them - I'm sure people could do a LOT more with it - I haven't done much with Javascript etc.

If you can make something that's good, be sure to attach it here for other peoplet o use.

Posted

I'm trying my little heart out to get it working right now...but for some reason it keeps telling me the object isn't there...I'm using the exact same code I've used in other projects...i have no idea why it wouldn't work...

Posted

ok here's how it's done...have to add one new function that will toggle the visibility:

function toggleDiv(itemno) {
 var tags = window.external.GetTagCount(itemno);
 for(var j = 0; j < tags; j++) {
   var temp = "document.all.blah" + itemno + "blah" + j + ".style.display";
   if (eval(temp)=="none") { eval(temp + "='block'"); }
   else { eval(temp + "='none'"); }
 }
}

Then need to modify another function or two:

function addTag(text, itemno, tagno)
{
 // retrieve this tag's attributes
 var disp = window.external.GetTagAttr("display", itemno, tagno);
 var checked = window.external.GetTagAttr("checked", itemno, tagno) == "true" ? "checked" : "";

 // set up the current tag's layout stuff - name of checkbox ends up being item4.tag2 etc.

 // Changed by eMpTy to give each row containing a checkbox a unique id.
 text += "<tr class='effectrow' id=\"blah"+itemno+"blah"+tagno+"\" style=\"display: none\">";

 text += "<td width='20' align='right'> </td>";
 text += "<td width='20'> </td>";
 text += "<td width='20' align='right' class='effectcheck'><input type='checkbox' name='item"+itemno+".tag"+tagno+"' "+checked+" id='"+disp+"'></td>";
 text += "<td width='1000' class='effectitem'> "+disp+"</td>";
 text += "</tr>";

 // return the updated layout
 return text;
}

Changed one line in that function, and I changed this one line in the addItem function, but you could really do this anywhere. All you need is access to the item number.

// Made the description of the item a link that toggles all the sub-items visibility.
text += "<td width='1000' class='itemdesc'> <a href=\"javascript: toggleDiv('"+itemno+"')\">"+desc+"</a></td>";

Posted

Perhaps it's easier to attach the HTML....?

Knowing other people's incapability with getting stuff working, perhaps it's not the best thing to get people to modify things they don't know much about.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...