WTable: how to obtain <tbody>'s id?
Added by Dottor Hell over 7 years ago
As explained in the subject, I need to know the id assigned to the
of a WTable.
I have written a little piece of code in my program, to try to undestand how the ids are assigned:
const Wt::WTableRow *row=table->rowAt(counter); // a specific row I'm interested in
cout << "----------" << endl << "rowid=" << row->id() << endl;
for (int i=0; i<table->children().size(); ++i)
{
cout << "table children" << i << "=" << table->children()[i]->id() << endl;
}
cout << "RowParent=" << row->parent() << endl;
cout << "----------" << endl;
In a table of 2 columns and 9 rows, these are the results.
rowid=o3r1cok // the specific row
table children0=o3r1c4y // th
table children1=o3r1c51 // th
table children2=o3r1c6i // td
table children3=o3r1c6j // td
table children4=o3r1c8r // td
table children5=o3r1c8s // td
table children6=o3r1caz // td
table children7=o3r1cb0 // td
table children8=o3r1cd7 // td
table children9=o3r1cd8 // td
table children10=o3r1cff // td
table children11=o3r1cfg // td
table children12=o3r1chn // td
table children13=o3r1cho // td
table children14=o3r1cjv // td
table children15=o3r1cjw // td
table children16=o3r1cm8 // td
table children17=o3r1cm9 // td
table children18=o3r1col // td
table children19=o3r1com // td
RowParent=0 // the row has no parent
The annotations come from inspecting the html page.
So apparently the WTable has as only children the
s and
s.
The rows have no parent.
And there is no clear (to me, at least) way to access the widgets connected to the
and
(even if they both actually have ids).
So, how can I find the values of
id, in Wt?
Thanks.
Replies (1)
RE: WTable: how to obtain <tbody>'s id? - Added by Dottor Hell over 7 years ago
Ok, I've risolved this on my own.
To access
and
you can use the same id of the table, adding, in order, "tb" or "th"
So, if a table has id="oh2iuba"
Tbody's id is "oh2iuba"+"tb"= "oh2iubatb"
Thead's id is "oh2iuba"+"th"="oh2iubath"