Table editor

  • 9 replies.
  • This is not yet resolved.
  • This question was started by Trevor.
  • Last post by Carl.
Trevor
member
February 12th 2010
I have a table model which contains optional title (tt), header (th) and footer (tf) elements, with a mandatory body (tb). Headers, bodies and footers contain one or more rows (tr), and rows (naturally) contain one or more cells (td).
I can use the "insert table" button off the main menu to insert a basic table, and then change body rows to header rows in the document view, but what I would like to do is modify the options provided by the "insert table" button. Check boxes for header row and totals row, and header column and totals columns, are inappropriate; I'd rather select how many header rows, how many body rows, how many footer rows, and so on.
What is the correct mechanism that will allow me to do that, please?
Sjoerd
Xopus Team
February 12th 2010
Hi Trevor,

The table inserter is not configurable at all. The only way to do this is to create a new button with a custom command and create your own table editor (a lot of work I admit)

You're not the first to ask for this, but we're not sure yet how to implement this.

The HTML table model is unfortunate as it has two ways to indicate headers (with thead and th), which is confusing no matter how it is presented to users.
Trevor
member
February 15th 2010
Thanks for answering.

Hmm. Does your comment about implementation mean that this feature is already a planned enhancement? If not, do you have an example somewhere that I could perhaps use as a starting point for this exercise?
Sjoerd
Xopus Team
February 16th 2010
As long as we do not have a good way to implement this, nothing will be planned.

One idea would be to have a configuration option that the header row and totals row options insert thead and tfoot elements. I don't think we will add UI to allow to enter the number of rows in thead and tfoot. (Word doesn't have this either, and you can add those later.)

Would that be enough?

We don't have an example of a custom-built table inserter. It would mostly be regular html/css/javascript together with some API calls to create table elements and to insert the table.
Trevor
member
February 16th 2010
Well: the built-in widget offers me header/totals row and header/totals column checkboxes, plus a table dimension picker graphic. In most cases I expect users to select a header row and a dimension, and pass up the other options.

But: if I check the "header row" option and click in the graphic to select a 2x2 table, the widget shows me 1 header row and 1 body row, but this is not what is inserted in the document. The new table contains a tb (body) with 2 rows (tr) of 2 cells (td) each. But Xopus knows that my header rows really belong in a th element, because if I click on "table" in the structure on the status line at the bottom of the document window, I am offered "insert table header", and that inserts a table header of 1 row with the right number of table cells. I understand how to do this, but it's not very intuitive.

So: what would be really useful would be if the built-in table inserter could recognise that "header row" in the widget corresponds to my th node (which has been assigned the "tableheader" and "tablerowcontainer" roles in xopus-config.xml). If it could do a similar job with the totals // tf node (tablefooter and tablerowcontainer) that would be the icing on the cake.

Is this realistic?
Sjoerd
Xopus Team
February 18th 2010
It certainly is.

By the way, did you assign the tableheadercell role, and if so, to which element? (As it doesn't seem to have an effect in your case, which sounds like a bug.)
Trevor
member
February 18th 2010
Sounds good :-)

I have the following nodes defined in my xopus-config.xml (this is just the bit relevant to tables):

<x:node match="table"><x:role>table</x:role></x:node>
-- remainder abbreviated --
match=tt role=tablecaption
match=th role=tableheader, tablerowcontainer
match=tb role=tablebody, tablerowcontainer
match=tf role=tablefooter, tablerowcontainer
match=tr role=tablerow. tablecellcontainer
match=td role=tablecell, tableheadercell
match=@rowspan
role=cellrowspan
match=@colspan
role=cellcolspan

Cheers
T
Sjoerd
Xopus Team
February 18th 2010
Ok. I would remove the tableheadercell role from the td. This removes the header options from the tableinserter.

Once we have the idea above implemented, the header row and footer row options should reappear (and not the column options).
Lukasz
anonymous user
April 19th 2010
I have probem with table header. When table is created all rows are created in thead element
<thead>
<tr><th/></tr>
<tr><td/></tr>
<tr><td/></tr>
</thead>
<tbody/>
How I can force xmetal to create rows with td in tbody element ?
Carl
Xopus Team
April 22nd 2010
There is no perfect way to solve this. The issue depends greatly on configuration and schema.

Configuration can be used to map th and thead to their proper roles for the Xopus TableInserter. However this will not result in the expected result because the two elements more or less mean the same, also to Xopus. It will not give the following:

<thead>
<tr><th>...
</thead>
<tbody>
<tr><td>...
</tbody>

Removing minOccurs="0" from the thead in the schema is probably the best solution, and then relying on the role for th to insert:

<tbody>
<tr><th>...
<tr><td>...
</tbody>

React

HTML will be shown as HTML code.
Linebreaks and Links starting with http:// are automatically resolved