Hi!
I tried it in a separate empty document with just the following code:
<html>
<script>
if((document.getElementId('x9').innerHTML === '')) { //If a cell is
empty
document.getElementId('x7').style.display = 'none'; //Remove the line
</script>
<table id="x1" border="1">
<tr id="x2"><td id="x3" colspan="2">Title</td></tr>
<tbody id="x4">
<tr id="x5"><td id="x6" colspan="2">Subtitle1</td></tr>
<tr id="x7"><td id="x8">test1</td><td id="x9"></td></tr>
<tr id="x10"><td id="x11">test2</td><td id="x12">2222</td></tr>
</tbody>
<tbody id="x13">
<tr id="x14"><td id="x15" colspan="2">Subtitle2</td></tr>
<tr id="x16"><td id="x17">test3</td><td id="x18"></td></tr>
<tr id="x19"><td id="x20">test4</td><td id="x21"></td></tr>
</tbody>
</table>
</html>
I even put the script after the table, but nothing happened.
w
On Jan 20, 3:47 pm, Julian Knight <[email protected]> wrote:
> Hi, not in a position to test code right now but I can see that the script
> is a little too simple.
>
> It would be better if you could put ID's on all of the rows and cells for a
> start, preferably numbered so row R01 would contain cells R01C01 and R01C02
> etc. That way you can easily id the row from a cell. Otherwise you will need
> to mess with XPaths which is probably more efficient but rather harder to
> get your head around.
>
> Then for each row, you will need to check if each of the cells is empty - in
> your example, of course, you'd only need to check the second cell on each
> row as the first is never empty. Keep count of the empty rows and if the
> final count is the same as the total number of rows, you can remove the
> table, otherwise remove the empty rows.
>
> Also, the code you have there will operate on EVERY table in your TW file,
> not something you really want. ID your tables or use a more complex search
> (using JQuery is easier for such things) to ensure that you have got the
> right table. Remember that any Javascript will operate on the whole document
> unless you tell it otherwise.
>
> Regards, Julian Knight
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywiki?hl=en.