Opened 9 years ago

Closed 8 years ago

#16935 closed defect (invalid)

dojox/layout/TableContainer removeChild() doesn't work.

Reported by: gaurav21r Owned by: gaurav21r
Priority: undecided Milestone: tbd
Component: DojoX Layout Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:


In TableContainer? , we have a member function removeChild(child).

When trying to call removeChild() of the TableContainer?, although the child widget is removed, we are still left with its label.

Reproduction in dojox tests

We can easily reproduce this bug within the dojox tests (therefore proving that it isn't an isolated case). In the console,

tc = dijit.registry.byId('tc1');
child =  tc.getChildren()[0];

This removes the first TextBox? but doesn't remove the label.

The TableContainer? is a core part of a new Application Development Platform we are building out of Dojo, so I'd really appreciate it if this bug is given priority.


Change History (4)

comment:1 Changed 9 years ago by gaurav21r

I'm sorry I forgot to give the link for the HTML with the test.

comment:2 Changed 8 years ago by dylan

dojox/layout/TableContainer is really not designed with things like this in mind.

What it is doing is recursing over the list of children, and if the showLabels property is set to true, then its added an extra table cell for the label. However, this isn't part of the child widget, it's simply an associated node.

I looked for a quick fix for this, e.g. adding the label node to a child.own call, e.g. if (labelCell) {child.own(labelCell);} and then trying things like this:

tc = dijit.registry.byId('tc1'); child = tc.getChildren()[0]; tc.removeChild(child); child.destroy();

This widget is unfortunately not a great example of modern Dojo best practices, and should really be rewritten.

comment:3 Changed 8 years ago by dylan

Owner: set to gaurav21r
Status: newpending

Actually, I spoke too soon...

Adding the following should work, if this is the desired effect:

if (labelCell) {child.own(labelRow);}

provided that you also destroy the widget (rather than just calling removeChild)

If you want to work on a pull request, I'll review it, though this won't land for 1.10.

comment:4 Changed 8 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.