Tags:
create new tag
view all tags

SID-01165: Comparing text of a Twiki Table

Status: Answered Answered TWiki version: 5.0.0 Perl version: 5.005
Category: CategoryJavaScript Server OS: RedHat Linux Last update: 14 years ago

Hello, I have a comment template that outputs a table where the rows look like this:

x Hp x x x x x x

And I want to be able to pull the rows from the table into another table based on the info in the second cell.

I wrote a javascript function, shown below, but I can't get it to compare the cell contents to check for HP. Any guidance you have here?

showHp() { var theRows=document.getElementById("table1").getElementsByTagName('tr'); var numRows=theRows.length; numRows=numRows-1; for(i=numRows;i>=0;i=i-1) { var rowMan=theRows[i].cells[1].firstChild.data; if (rowMan == "Hp") { var rowToAdd=document.getElementById("table1").rows[i]; var newRow=rowToAdd.cloneNode(true); document.getElementById("outPutTable").appendChild(newRow); } } }

-- JoshuaTatman - 2011-05-04

Discussion and Answer

Hello,

Different approach (TWiki native)

Check SearchPatternCookbook

Instead of producing a the option list of the example you could produce the table you want.

-- EnriqueCadalso - 2011-05-05

I figured it out, thank you much.

-- JoshuaTatman - 2011-05-06

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Comparing text of a Twiki Table
SupportCategory CategoryJavaScript
TWiki version 5.0.0
Server OS RedHat Linux
Web server Apache
Perl version 5.005
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2011-05-06 - JoshuaTatman
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.