Ticket #4817 (closed defect: fixed)

Opened 13 months ago

Last modified 13 months ago

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

Reported by: tk Owned by:
Priority: normal Milestone: 1.0
Component: Dijit Version: 0.9
Severity: normal Keywords: tree labelNode iconNode class
Cc:

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

Tree.diff (3.0 kB) - added by tk 13 months ago.
Patch for review

Change History

Changed 13 months ago by tk

Patch for review

Changed 13 months ago by ktiedt

  • status changed from new to closed
  • resolution set to fixed

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

Changed 13 months ago by tk

  • status changed from closed to reopened
  • resolution deleted

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

Changed 13 months ago by ktiedt

  • status changed from reopened to closed
  • resolution set to fixed

(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.

Changed 13 months ago by bill

  • status changed from closed to reopened
  • resolution deleted

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.

Changed 13 months ago by ktiedt

  • status changed from reopened to closed
  • resolution set to fixed

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

Changed 13 months ago by peller

  • status changed from closed to reopened
  • resolution deleted

[11034] appears to have broken themeTester

Changed 13 months ago by ktiedt

  • status changed from reopened to closed
  • resolution set to fixed

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

-Karl

Changed 13 months ago by ktiedt

(In [11061]) refs #4817

node.className not node.style.className

Note: See TracTickets for help on using tickets.