PDA

View Full Version : when does a grid View become ready ?



acorus
9 Jul 2009, 8:37 AM
Hello !

I just downloaded release 2 and met a problem with Grid
rendering.

I need to use custom cell colors for a grid
displaying a calendar. I have used this
event handler in m3 release:


calendarGrid.addListener(Events.Render, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent event) {
Boolean ready = calendarGrid.isViewReady(); //this is true for m3, false for release 2
if (ready)
setupCellColors();
}
});


An you can see from my commented code, it seems that behavior in final
release is different from previous milestones.

What is wrong ? Which event should I intercept in order to be able to
access the grid View and modify it ?

Can anybody help me ?
Thanks in advance.

acorus
12 Jul 2009, 8:08 AM
I found a solution, though things are still not clear to me (behavior
has changed several times starting from milestone 1 to m2 to m3 to final
release).

I have added a DeferredCommand to the event handler:

------------------------------------------------------------------------------------------------------
calendarGrid.addListener(Events.Render, new Listener<ComponentEvent>() {

public void handleEvent(ComponentEvent event) {
Boolean ready = calendarGrid.isViewReady();
// why is ready 'false' ?

//with this it works
DeferredCommand.addCommand(new Command() {
public void execute() {
setupCellColors();
}
});

}
});
-------------------------------------------------------------------------------------------------------

Maybe the 'Render' event is raised before rendering ? if so, how do I get an after-render event ? Where is this stuff clearly described ?
Thanks a lot to anybody who wants to help me.