Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4817 closed defect (fixed)

dijit.Tree -- needs a way to update icon and labelNode classes

Reported by: tk Owned by:
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: tree labelNode iconNode class Cc:
Blocked By: Blocking:

Description

Basically if you have a Tree where you are using custom icon/labelNode classes, and you update one of those properties on a Tree_node, the icon/label classes will never update since these calls are only done via postCreate();

Patch included that adds defaultItem/LabelNodeClasses variables (needed to revert these nodes to their original state and then append their updated class names to them (otherwise you get long long classNames)

Attachments (1)

Tree.diff (3.0 KB) - added by tk 12 years ago.
Patch for review

Download all attachments as: .zip

Change History (9)

Changed 12 years ago by tk

Attachment: Tree.diff added

Patch for review

comment:1 Changed 12 years ago by Karl Tiedt

Resolution: fixed
Status: newclosed

(In [11028]) fixes #4817 slightly modified from patch file, per discussion with Alex. Also includes some whitespace fixes I found while editing.

comment:2 Changed 12 years ago by tk

Resolution: fixed
Status: closedreopened

Reopening to submit a cleaner fix (removing oldClasses so they dont keep piling up)

comment:3 Changed 12 years ago by Karl Tiedt

Resolution: fixed
Status: reopenedclosed

(In [11033]) Fixes #4817 Found that Tree wasnt implenenting the full notification API for onSet(), implemented it to allow _updateItemClasses to remove old class names prior to adding new ones.

comment:4 Changed 12 years ago by bill

Resolution: fixed
Status: closedreopened

The above change isn't right. Dojo.data's onSet() method is connected to

_onSetItem: function(/*Object*/ item, /*attribute-name-string*/ attribute, /*object | array*/ oldValue, /*object | array*/ newValue)

which calls

_updateItemClasses: function(item, oldValue, newValue)

oldValue and newValue in _onSetItem are either

  • the value of an attribute of an item
  • an array of attribute values of an item
  • possibly null

They are *not* CSS class names. But _updateItemClass() assumes that oldValue and newValue are CSS class names. Maybe your item's attribute's value is a CSS class name you can't make that assumption for everyone.

Also, calling hasClass() before removeClass() is unnecessary.

comment:5 Changed 12 years ago by Karl Tiedt

Resolution: fixed
Status: reopenedclosed

(In [11034]) per discussion with Bill, this meets his criteria fixes #4817

comment:6 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: closedreopened

[11034] appears to have broken themeTester

comment:7 Changed 12 years ago by Karl Tiedt

Resolution: fixed
Status: reopenedclosed

(In [11058]) fixes #4817 again... :) this.getIcon/LabelClass() doesnt exist... its this.tree.getIcon/LabelClass()

-Karl

comment:8 Changed 12 years ago by Karl Tiedt

(In [11061]) refs #4817

node.className not node.style.className

Note: See TracTickets for help on using tickets.