Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6173369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:33:36+00:00 2026-05-23T23:33:36+00:00

Goal: When you click the text info in the column comments, a row should

  • 0

Goal:
When you click the text “info” in the column “comments”, a row should be displayed below with text information that is related to the “comments”. Need also to click the text “Info” again to hide the text information of comments.

Problem:
I don’t know how to display the row when you click one of the comments with the text “info”. When clicking one of the link the remaining rows with the text “info” should not be affected. In order words, the part should be independent

Need also some help hiding the text information of comments.

There are some things that you also need to take account to:

  • The amount of data that will be displayed in the table will be
    changed from day to day. The data is taken from a xml file.
  • Would like the sourcode to be written in jQuery.
  • Only html, css and javascript is allowed in this context.
  • html code in tr and td will be generated by javscript code.

enter image description here

Please remember that the text hide and show is only for temporary.

// Fullmetalboy


$(document).ready(init);

function init() 
{
    startPoint();
}



var mittXHRobjekt = null;

function skapaXHRobjekt() {
    try {
        mittXHRobjekt = new XMLHttpRequest();  // Firefox, Opera, ...
    } catch (err1) {
        try {                              // Någon IE version
            mittXHRobjekt = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (err2) {
            try {                           // Någon IE version
                mittXHRobjekt = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (err3) {
                mittXHRobjekt = false;
            }
        }
    }


    if (mittXHRobjekt == null) {
        alert('Error creating request object!');
    }


    return mittXHRobjekt;
}


function startPoint() {
    var xmlAdress = "data.xml";
    mittXHRobjekt = skapaXHRobjekt();
    if (mittXHRobjekt) {
        mittXHRobjekt.onreadystatechange = function () {
            if (mittXHRobjekt.readyState == 4) {
                testt();




            } //if 
        } //slut på anonym funktion som utförs när tillståndet i XHR ändras 
        mittXHRobjekt.open("GET", xmlAdress);
        mittXHRobjekt.send(null);
    }
} //slut på funktionen visaKurs



function testt()
{
    var data = retrieveDataFromXML();

    var data2 = briefAllProject(data);

    AddRow(data2);


}


function retrieveDataFromXML() {

    //Hämtar alla taggar av typen kurs 
    var projektnamn = mittXHRobjekt.responseXML.getElementsByTagName("projektnamn");
    var kommentar = mittXHRobjekt.responseXML.getElementsByTagName("kommentar");
    var datum = mittXHRobjekt.responseXML.getElementsByTagName("datum");    
    var timmar = mittXHRobjekt.responseXML.getElementsByTagName("timmar");  
    var minuter = mittXHRobjekt.responseXML.getElementsByTagName("minuter");

    var araay = new Array();
    var nummer = 0;

    //Har nu en matris/array av <kurs> noder. Kan loopa genom matrisen 
    for (a = 0; a < projektnamn.length; a++) 
    {

        for (b = 0; b < 5; b++) 
        {

            if(b == 0)
            {
                araay[nummer] = projektnamn[a].firstChild.data;
            }
            else if(b == 1)
            {
                araay[nummer] = kommentar[a].firstChild.data;
            }
            else if(b == 2)
            {
                araay[nummer] = datum[a].firstChild.data; 
            }
            else if(b == 3)
            {
                araay[nummer] = timmar[a].firstChild.data; 
            }                   
            else if(b == 4)
            {
                araay[nummer] = minuter[a].firstChild.data;
            }

            nummer++;
        }

    }

    return araay;
} //slut på fyllElementMedDataFranServern






function AddRow(pArray)
{

    var b=0;
    var tabell = document.getElementById("tblProjekt");
    var tabell2 = document.getElementById("tblProjekt");
    var newRow;

    var c = 1;
    var test = 0;

    for(a=0; a < pArray.length/4; a++)
    {

        newRow = tabell.insertRow(tabell.rows.length);

        for(b=1; b <= 4; b++)
        {
            var newCell;

            if(b == 1)
            {
                newCell = newRow.insertCell(0);
                newCell.innerHTML = pArray[test + 0];
            }
            else if(b == 2)
            {
                newCell = newRow.insertCell(1);
                newCell.innerHTML = pArray[test + 1];
            }
            else if(b == 3)
            {
                newCell = newRow.insertCell(2);
                newCell.innerHTML = pArray[test + 2];
            }       
            else if(b == 4)
            {               
                newCell = newRow.insertCell(3);
                newCell.innerHTML = "Info";
                //newCell.innerHTML = pArray[test + 3];


                newRow = tabell2.insertRow(tabell2.rows.length);
                //newCell = newRow.insertCell(0);

                var newAttrColspan = document.createAttribute("colspan");
                newAttrColspan.nodeValue = 4;

                newRow.className = "firstDataRow";
                //newRow.id = "firstDataRow";

                var newCell = newRow.insertCell(0);
                newCell.setAttributeNode(newAttrColspan);
                newCell.innerHTML = "asdf";

                //$("#firstDataRow").hide();
                //$(".aaa").hide();

            }


        }

        test = 4 + test;
    }

}






$(document).ready(function() 
{


    $('.submit').click(function()
    {

        $(".firstDataRow").hide();

    }); // saveForm


    $('.submitt').click(function()
    {

        $(".firstDataRow").show();

    }); // saveForm


}); // ready 









function briefAllProject(pArray)
{

    var araay = new Array();

    var nummer5 = 0;
    var nummer3 = 3;


    var projectNameArray = new Array();
    var newArray=new Array();

    for (a = 0; a < pArray.length/5; a++) 
    {
        newArray[a] = pArray[nummer5];

        nummer5 = 5 + nummer5;
    }

    projectNameArray = removeDuplicates(newArray);


    nummer5 = 0;
    nummer3 = 0;



    var sanning = true;
    var dontAddValue = true;

    for (var a = 0; a < projectNameArray.length; a++) 
    {

        for (var b = 0; b < pArray.length/5; b++) 
        {

            if(   (projectNameArray[a] == pArray[nummer5]) &&  (pArray[nummer5] != null) && (a < projectNameArray.length)   )
            {

                if(sanning == true)
                {
                    araay[0 + nummer3] = pArray[0 + nummer5]; // namn
                    araay[1 + nummer3] = mergAllTimeOfSpecificProject(pArray , pArray[0 + nummer5]);
                    araay[2 + nummer3] = "Info"; // info
                    araay[3 + nummer3] = pArray[1 + nummer5]; // kommentar                      

                    nummer3 = nummer3 + 4;

                    sanning = false;
                }

            }

            nummer5 = nummer5 + 5;
        }

        nummer5 = 0;
        sanning = true;

    }


    return araay;
}



function mergAllTimeOfSpecificProject(pArray , pProjectName)
{
    var aa = 0;

    var nummer5 = 0;

    for(a = 0; a < pArray.length/5; a++)
    {
        if(pArray[nummer5] == pProjectName)
        {
            aa += parseInt(pArray[3 + nummer5]);
        }

        nummer5 = 5 + nummer5;
    }

    return aa;
}


function removeDuplicates(arr)
{
    //get sorted array as input and returns the same array without duplicates.
    var result=new Array();
    var lastValue="";


    result[0] = arr[0];

    var kth = 0;
    var sanning = true;

    for (var a=0; a < arr.length; a++)
    {

        for(var b=0; b < arr.length; b++)
        {

            if (result[kth] != arr[b])
            {

                for(var aa = 0; aa < result.length; aa++)
                {

                    if(result[aa] == arr[b])
                    {
                        sanning = false;
                    }

                }


                if(sanning == true)
                {
                    result[result.length] = arr[b];
                    kth++;
                }
                else
                {
                    sanning = true;
                }

            }

        }

    }

    return result;
}

        <table border="1" SUMMARY="aaa" id="tblProject">
          <thead>
            <tr>
              <th>Projekt name</th>
              <th>Total time</th>
              <th>Task</th>
              <th>comments</th>
            </tr>
          </thead>
          <tbody>

          </tbody>
        </table>

    <a href="#" class="submit">hide</a>

    <a href="#" class="submitt">show</a>

<?xml version="1.0" encoding="UTF-8" ?>

<projektarbeten>
    <projekt>
        <projektnamn>aaaa</projektnamn>
        <kommentar>kommentar</kommentar>
        <datum>2011-3-3</datum>
        <timmar>6</timmar>
        <minuter>0</minuter>
    </projekt>
    <projekt>
        <projektnamn>bbbb</projektnamn>
        <kommentar>kommentar</kommentar>
        <datum>2011-3-3</datum>
        <timmar>2</timmar>
        <minuter>0</minuter>
    </projekt>
    <projekt>
        <projektnamn>aaaa</projektnamn>
        <kommentar>kommentar</kommentar>
        <datum>2011-3-3</datum>
        <timmar>6</timmar>
        <minuter>0</minuter>
    </projekt>
    <projekt>
        <projektnamn>cccc</projektnamn>
        <kommentar>kommentar</kommentar>
        <datum>2011-3-3</datum>
        <timmar>10</timmar>
        <minuter>0</minuter>
    </projekt>
    <projekt>
        <projektnamn>cccc</projektnamn>
        <kommentar>kommentar</kommentar>
        <datum>2011-3-3</datum>
        <timmar>10</timmar>
        <minuter>0</minuter>
    </projekt>
    <projekt>
        <projektnamn>cccc</projektnamn>
        <kommentar>kommentar</kommentar>
        <datum>2011-3-3</datum>
        <timmar>10</timmar>
        <minuter>0</minuter>
    </projekt>
    <projekt>
        <projektnamn>kth ss</projektnamn>
        <kommentar>kommentar</kommentar>
        <datum>2011-3-3</datum>
        <timmar>14</timmar>
        <minuter>0</minuter>
    </projekt>
    <projekt>
        <projektnamn>kth ss</projektnamn>
        <kommentar>kommentar</kommentar>
        <datum>2011-3-3</datum>
        <timmar>50</timmar>
        <minuter>0</minuter>
    </projekt>              

</projektarbeten>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:33:38+00:00Added an answer on May 23, 2026 at 11:33 pm

    I’d suggest you to use a table plugin for jquery. I’ve been using datatables for two years and i find it particulary useful. Look at this example that perfectly suits your case io think:
    http://datatables.net/release-datatables/examples/api/row_details.html

    Look at this fiddle for an example: http://jsfiddle.net/nicolapeluchetti/5QhNx/3/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So the goal I am trying to achieve is that when I click on
My goal is to have the user be able to click the row and
My goal is to let the user click on a specific location on a
Folks, I need to accomplish some sophisticated web crawling. The goal in simple words:
My website structure is a header, content, footer. My goal is that every time
I am creating a page that a user can click a link and it
my goal is to open a ContextMenuStrip on right click remember this click x
My goal is to change tab's title to the one in the text field,
I'm busy writing a servlet that generates HTML code. The goal is to create
Goal: Get the TEXT address and then display the street view and map view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.