Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    1
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Collapse Expand Inside textArea

    i presently have a text area which is generated using two arrays.It is loaded at the screen load. It is as following.

    var channelsGroups = new Array();
    var channelsChildren = new Array();
    channelsGroups[0]= new Array('Mars Public', 'MARS-PUB');
    channelsChildren[0]=new Array();
    channelsGroups[1]= new Array('Mars Private', 'MARS-PRIVA');
    channelsChildren[1]=new Array();
    channelsGroups[2]= new Array('Internet Booking Engine', 'IBE');
    channelsChildren[2]=new Array();
    channelsGroups[3]= new Array('mars Private Agent Specific', 'M-P-AGENT');
    channelsChildren[3]=new Array();
    channelsChildren[3][0]=new Array('AGT_002',' AGT_002 ');
    channelsChildren[3][1]=new Array('CARLSON WAGONLIT AUSTRALIA PTY',' 235830 ');
    channelsChildren[3][2]=new Array('Travel Zone',' TRAVELZONE ');
    channelsChildren[3][3]=new Array('Worldlink Travels',' WORLDLINK ');
    channelsChildren[3][4]=new Array('AAAAAAARFDS',' ADM2 ');
    channelsChildren[3][5]=new Array('AAASSRet',' DMM3 ');
    channelsChildren[3][6]=new Array('Adrian Travels',' DMM1 ');
    channelsChildren[3][7]=new Array('Buraha Travels',' DMM2 ');
    and more

    Output in the textArea is as following
    i presently have a text area which is generated using two arrays.It is loaded at the screen load. It is as following.

    i presently have a text area which is generated using two arrays.It is loaded at the screen load. It is as following.

    Mars Public
    Mars Private
    Internet Booking Engine
    mars Private Agent Specific
    -AGT_002
    -CARLS...

    I hope you inderstand the pattern. I want first to display only the groups(Mars Public, Mars Private) and when someone clicks on mars private Agent specific, the list of agents appear. There are other groups below agents and those groups also may have children.Those groups also should have the same on click functioanlity? Any Idea?

    Thank you in advance...

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    974
    Thanks
    19
    Thanked 212 Times in 210 Posts
    Pardon me for saying so, but
    this is not an appropriate use
    of a textarea, while it is possible
    to accomplish this task it would be
    much better to display your collapsible
    list with an UL (unordered list)
    which can be more easily expanded
    and collapsed with javascript and/or
    css

  • Users who have thanked DaveyErwin for this post:

    ghtvnath (09-01-2010)

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,378
    Thanks
    11
    Thanked 592 Times in 572 Posts
    it can be done, but it's going to be quite a bit of code to accomplish the task. IE and FF handle textrea clicks/selections differently, so there's at least two copies of the same thing to write.

    It would probably be much easier to use the textarea to show only the expanded text of whatever collapsed branch was active, perhaps using buttons to navigate.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • Users who have thanked rnd me for this post:

    ghtvnath (09-01-2010)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •