On Monday, November 14, 2016 at 11:06:19 AM UTC+1, Thomas Broyer wrote: > > > > On Monday, November 14, 2016 at 10:51:35 AM UTC+1, [email protected] > wrote: >> >> I have some problems when using a CellTree within a DataGrid. >> Everything works except when clicking on the tree, nothing happens. >> I would expect the tree to expand/retract. >> Does anyone know of a solution ? >> > […] > >> private void buildCell(Node rowValue, String cellStyles, >> TableRowBuilder row) { >> NodesTree hw = new NodesTree(rowValue); >> TableCellBuilder td = row.startTD().colSpan(5); >> td.className(cellStyles); >> DivBuilder div = td.startDiv(); >> String t = hw.getWidget().getElement().getInnerHTML(); >> > > First, widgets' event wiring is done in such a way that they need to be > "attached" for the events to actually be listened to; see > https://github.com/gwtproject/old_google_code_wiki/blob/master/DomEventsAndMemoryLeaks.wiki.md > > for an oldish explanation. > Second, even if that wasn't the case, you couldn't expect event handlers > to be preserved when "serializing" the widget's element to HTML and then > re-parse it (moreover, you're taking the innerHTML of the element here, > which excludes the element itself, therefore would have excluded all event > handlers set on the element, *if* serialization would have preserved them, > which is not the case) > > So, sorry, but that's not going to work. > It might be possible hacking around: generate placeholder elements in > buildCell and schedule a task that will "attach" the CellTree to the > placeholder element; each time the cell is re-rendered. >
Thank you for the reply. I would like to try your hack. Which class could i use as a placeholder ? Do you have some example-code to do that ? (I am not an expert of GWT)... -- You received this message because you are subscribed to the Google Groups "GWT Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
