Wt::WTableRow::jsRef ?
Added by lm at over 3 years ago
It looks like Wt::WTableRow does not have a jsRef member function: https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WTableRow.html. jsRef is defined on Wt::WWebWidget: https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WWidget.html#a83a186d2feacfbfbdb5b54f4cefc6735. I guess Wt::WTableRow is not Wt::WebWidget (perhaps because it, itself, is not usually visible to the end user?), but it certainly should have a jsRef()...maybe I'm missing it?
In my case, I'm wanting to make a row appear like this: https://jsfiddle.net/0m8jot23/1/. This requires adding a row with class row-collapsed, then doing
doJavaScript("setTimeout(()=>" + new_row->jsRef() + ".className = 'row-expand', 1);"};
or so. In other words, I need a javascript reference to my row so that I can change its class name, but there is no jsRef member function on the row.
Replies (2)
RE: Wt::WTableRow::jsRef ? - Added by Roel Standaert over 3 years ago
Yeah, WTableRow itself isn't a widget. A jsRef() may be useful, but for now you could work around it by either:
- Taking the
jsRef()of aWTableCelland moving up the DOM to the<tr>element:cell.jsRef() + ".parentElement" - Taking the n-th row in the table:
table.jsRef() + ".querySelector(':scope > tbody > tr:nth-child(n)')"(withnstarting from1), ortable.jsRef() + ".querySelectorAll(':scope > tbody > tr')[n]"(withnstarting from0)