lundi 26 mai 2014

Adding a Class to a Dataview Item

I'm not a Javascript pro, so I'm having a bit of trouble adding a class to a dataview item when a toolbar button is pressed.

Essentially when the toolbar button is pressed, the following function is called:



Code:



var questionBank = Ext.getCmp('questionSelector');
var currentQuestion = this.getCurrentQuestion();
var questionItem = questionBank.getItemAt(currentQuestion);

questionItem.addCls('x-item-selected');

This results in the following error: Uncaught TypeError: undefined is not a function

Adding a console log of 'questionItem' shows that the data item is being selected. The result:



Code:



<div class="x-dataview-item id="ext-element-47">...</div>

Any ideas on why attempting to getCls or addCls renders an error?


Aucun commentaire:

Enregistrer un commentaire