Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1779 closed defect (fixed)

InlineEditBox can't be created programatically

Reported by: bill Owned by: Douglas Hays
Priority: high Milestone: 0.9
Component: Widgets Version: 0.4
Keywords: Cc:
Blocked By: Blocking:


var c = document.createElement("span");
c.innerHTML = 'testing some more';
testing some more
dojo.widget.createWidget('inlineEditBox', {widgetId: 'd'}, c);
TypeError on line 757: sourceNodeRef.parentNode has no properties

InlineEditBox? works by adding an <input> next to the original dom node, and then displaying/hiding one or the other depending on which mode you are in. As a side effect of that design you can't create it programatically.

Change History (7)

comment:1 Changed 15 years ago by jkuhnert

Just as an fyi, it actually does work creating it manually, just not the way you described.

dojo.widget.createWidget('inlineEditBox', {widgetId:'d',textValue:'What to edit'}, 'anyDivWeDontCare');

Unless the contents of the widget contains more widgets it seems only fair for those of us that do create from script in the majority case to allow all properties to be parameterizable.

Scriptaculous has a similar control, though it covers many more seemingly unnecessary options.(or maybe they do make sense, being able to bind into an existing form may actually be useful)

comment:2 Changed 15 years ago by bill

OK, I talked to Jesse about this and I have to revise my statement. I think it works if you specify a source domnode *and* that node is in the document tree. But there are some other issues that come up; basically because InlineTextBox?.domNode only points to the <input> node, rather than a <span> that contains the original node and the <input> node.

  1. calls like InputTextBox?.hide() won't do anything if you are in read-only mode.
  1. similarly, drag & drop wouldn't work because you'd only be dragging the <input> and the <h2> wouldn't move
  1. of course you can't do document.appendChild(myITB.domNode) because that will move the <input> node so it's no longer next to the corresponding <h2>

Basically, it's breaking the paradigm that we're using w/the other widgets.

comment:3 Changed 15 years ago by Douglas Hays

Owner: changed from bill to Douglas Hays

comment:4 Changed 15 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [7804]) Fixes #1779.

comment:5 Changed 15 years ago by Douglas Hays

Resolution: fixed

(In [7805]) Fixes #1779.

comment:6 Changed 15 years ago by Douglas Hays

(In [7807]) Refs #1779.

comment:7 Changed 15 years ago by Douglas Hays

(In [7808]) Refs #1779.

Note: See TracTickets for help on using tickets.