class Bosses < Netzke::Basepack::Grid
def configure(c)
super
c.model = "Boss"
end
js_configure do |c|
# Overriding initComponent
c.init_component = <<-JS
function(){
// calling superclass's initComponent
this.callParent();
// alert(this.getCount());
// setting the viewready event
this.on('afterrender', function() {
console.log(this);
alert(this.getStore().getCount());
alert('Hit any key to continue');
console.log(this.getStore().getAt(1));
return true;
}, this);
}
JS
end
end
*** code end ******
As you can see to the above code I want to catch the afterrender event and select the first element. BUT the render has not happen yet, so I get undefined first element. How can I make this event handler to be called after the list of bosses are shown in the grid. I also tried 'show' 'beforeshow' events and none of them worked.
Thanks a lot for your help