Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#5122 closed defect (wontfix)

Grid onStyleRow removes -selected and -odd classes, inRow.selected

Reported by: guest Owned by: sorvell
Priority: high Milestone: 1.1
Component: DojoX Grid Version: 1.0
Keywords: grid onstylerow Cc: [email protected]
Blocked By: Blocking:


The use of onStyleRow in the creation (markup or programmatic) of a Grid removes two of the three standard classes optionally associated with all the rows: dojoxGrid-row-odd, dojoxGrid-selected. The class dojoxGrid-row is not removed from the row's class.

A selected, odd row without the onStyleRow parameter.

<div class="dojoxGrid-row dojoxGrid-row-odd dojoxGrid-row-selected" style="">

The same selected, odd row with the onStyleRow parameter in the Grid definition.

<div class="dojoxGrid-row" style="">

Seems the use of onStyleRow should not change the row classes (className).

And, if present, and the inRow.customStyles = 'color:red' (as an example) is used, it should only affect the row's style, not the className.

And, if present, and the inRow.customClasses = 'specialRow' (as an example) is used, it should only affect the row's class, not the style.

The effect for .customStyles should probably be to replace the current style. This would allow the developer to optionally say .customStyles = .customStyles + ';color:red' or just .customStyles = 'color:red'.

Same for .customClasses

Also, the passed inRow object properly provides inRow.odd, inRow.customClasses, inRow.customStyles, but inRow.selected is undefined.

See attached modified test file from the latest dojox grid tests directory.

Attachments (1)

test_grid-onstylerow.html (3.0 KB) - added by guest 14 years ago.
Grid tests directory, onStyleRow ticket# 5122

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by guest

Attachment: test_grid-onstylerow.html added

Grid tests directory, onStyleRow ticket# 5122

comment:1 Changed 14 years ago by guest

orignal poster update: strike the inRow.selected problem report. seems to work just fine...

comment:2 Changed 14 years ago by guest

original poster update:

Workaround, and maybe the original intent. If so, please 'invalid' this ticket.

Inside the function called by onStyleRow:

  inRow.customClasses += ' dojoxGrid-row-odd';
  inRow.customClasses += ' dojoxGrid-row-over';
  inRow.customClasses += ' dojoxGrid-row-selected';
if (grid.model.getRow(inRow.index).active)  //user-specific test, boolean in this case.
inRow.customClasses += ' activeMuid';

comment:3 Changed 14 years ago by Adam Peller


comment:4 Changed 14 years ago by guest

Original Poster: It's probably best to mark this ticket 'invalid'. I believe the way it operates was the original intent. The only problem is the use of onStyleRow can cause a good deal of research the first time used to understand why the over, selected, and odd styling disappears when the user thinks they just added styling, comparable to connecting to other "events" lets the normal treatments continue, but gives you a chance to also respond to the event. Now that I know how it works, it is fine.

The only thing that perhaps should be done is to note on the documentation/example page Book--Grid Styles under "onStyleRow" the above restoration of normal styling that must be added to your onStyleRow function, if the user desires to retain it. Thanks.

comment:5 Changed 14 years ago by Frank Fortson

Resolution: wontfix
Status: newclosed

Original Poster: Closing, works as designed.

comment:6 Changed 14 years ago by guest

Added a note on the mentioned page about styling grid rows by connecting to "onStyleRow"

Note: See TracTickets for help on using tickets.