View Full Version : How can I add or remove a class to an DataView template item on selection?

6 Nov 2013, 9:36 AM
I'm kinda stumped on this one, I am firing the select routine fine. However I'm not sure how to reference the actual item that was clicked so I can manipulate it's css.

Gary Schlosberg
8 Nov 2013, 2:20 PM
The second argument from the select (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.view.View-event-select) event is the record selected.

11 Nov 2013, 4:47 AM
Yeah, but isn't that the record from the store (like the data)? I'm looking to get a reference to the html element corresponding to that record so I can manipulate it.

11 Nov 2013, 6:10 PM
Maybe this?

var el = view.getNode(record);

Though if you just want to hang some CSS off the selected node you could use the selectedItemCls.