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 3211254
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:42:51+00:00 2026-05-17T14:42:51+00:00

I have xml file with data that i have to display in table. Now

  • 0

I have xml file with data that i have to display in table. Now I am displaying all data row by row, so my table looks like:

User | Date | Something

John | 05.10| task_1    
John | 05.10| task_2    
John | 16.10| task_3
Jane | 16.10| task_1

but i want to get something like:

User | Date | Something

John | 05.10| task_1    
     |      | task_2    
     | 16.10| task_3
Jane | 16.10| task_1

so if date in particular cell is equal to corresponding cell in previous row ( or if that cell is empty then is equal to first non empty cell looking from bot to top) I would like to omit it.

Current code:

<table id="DataTable" datasrc="#XMLData" cols="3">
    <thead>
        <tr>
            <td class="Example">User</td>
            <td class="Example">Date</td>
            <td class="Example">Something</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><span datafld="USER"></td>
            <td><span datafld="DATE"></td>
            <td><span datafld="SOMETHING"></td>
        </tr>
    </tbody>
</table>

note:

this problem is from existing (old) system and my options are limited. Particularly I cannot change xml file and I shouldn’t use server based asp.net controls ( but I can if there is no other way / it’s simplest solution), so I aim for pure html & javascript solution most.

  • 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-17T14:42:52+00:00Added an answer on May 17, 2026 at 2:42 pm

    If it needs to be something quick and dirty, use something like this…. I am hoping that you only have a single tBody 😉
    Tested as working in FF (will need some crossbrowser clean up. will leave that to you). you might want to clean up the prevName/name comparison to suit your needs

    var tablemerge = {
        init : function(){
            var tab = document.getElementById("DataTable");
            var prevName, prevDate;
            for (i=0;i<tab.tBodies[0].rows.length;i++){
                var name = tab.tBodies[0].rows[i].cells[0].innerHTML;
                var date = tab.tBodies[0].rows[i].cells[1].innerHTML;
                if (i== 0) { 
                    prevName = name;
                    prevDate = date;
                    continue;
                }
                else{
                    if (name == prevName)
                    {
                        var cell = tab.tBodies[0].rows[i].deleteCell(0);
                        var cell = tab.tBodies[0].rows[i].insertCell(0);
                        if (date == prevDate)
                        {
                            var cell = tab.tBodies[0].rows[i].deleteCell(1);
                            var cell = tab.tBodies[0].rows[i].insertCell(1);
                        }
                        else{
                            prevDate = date;
                        }
                    }
                    else
                    {
                        prevName = name;
                        prevDate = date;
                    }
                }
            }
        }
    }
    tablemerge.init();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml file that looks something like this <Data> <NumberID>23423</NumberID> <NumberID>34234</NumberID> <NumberID>45435</NumberID>
For an XML file I am creating I have data that contains a bullet
Okay, to clarify, I have an XML/RDF file that describes data with a natural
I have generated an XML file that and one of the nodes contains data
I have a flash file that is loading data from XML file. After I
I have to read/write an XML file that stores its data as bit masked
I have an XML file containing some scientific text that I want to display
I now have two repeaters that need to look at 1 XML file but
I have an xml data file and I want to populate a listview in
I have a XML file with the following data format: <net NetName=abc attr1=123 attr2=234

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.