Hi
I was able to successfully observe “redraw” and “scrolled”. However, absolutely no joy observing “draw”. After thinking about it, it seemed that I may have been observing the method too late so, I set “autoDraw:false” in the grid, called observe and then, listGrid.show(). Unfortunately, this made no difference and observing “draw” for some reason, didn’t seem to work. I changed my observe target to:-
testButton.observe(countryList, "draw", "observer.stopIt()");
and the observe worked!
So, “redraw” and “scrolled” work against countryList.body, whereas “draw” only worked against countryList. I’m not sure why this is - I looked at “body” in the reference docs but I couldn’t see what “members” were available. I looked at the return type for “body” but that didn’t give any clues as to why I could reference some things via body (scrolled, redraw), but not others (draw). Is there a recommendation as to how to discover this kind of information?
Next, I decided to override the “draw” method but came across a curiosity that I cannot explain. See the code below:-
isc.ListGrid.create({
ID: "countryList",
top:50,
width:500, height:224, alternateRecordStyles:true, showAllRecords:true, autoDraw:false,
fields:[
{name:"countryCode", title:"Code"},
{name:"countryName", title:"Country"},
{name:"capital", title:"Capital"}
],
data:[
{countryCode:"US", countryName:"United States", capital:"Washington, DC"},
{countryCode:"CH", countryName:"China", capital:"Beijing"},
{countryCode:"JA", countryName:"Japan", capital:"Tokyo"},
{countryCode:"IN", countryName:"India", capital:"New Delhi"},
{countryCode:"GM", countryName:"Germany", capital:"Berlin"},
{countryCode:"UK", countryName:"United Kingdom", capital:"London"},
{countryCode:"FR", countryName:"France", capital:"Paris"},
{countryCode:"IT", countryName:"Italy", capital:"Rome"},
{countryCode:"RS", countryName:"Russia", capital:"Moscow"},
{countryCode:"BR", countryName:"Brazil", capital:"Brasilia"},
{countryCode:"CA", countryName:"Canada", capital:"Ottawa"},
{countryCode:"MX", countryName:"Mexico", capital:"Mexico (Distrito Federal)"},
{countryCode:"SP", countryName:"Spain", capital:"Madrid"},
{countryCode:"KS", countryName:"South Korea", capital:"Seoul"},
{countryCode:"ID", countryName:"Indonesia", capital:"Jakarta"}
],
draw: function() {
isc.say("draw");
//this.Super('draw', arguments);
}
})
isc.Button.create({
ID:"testButton",
title:"Hello",
stopIt : function() {
isc.say("stopit");
}
})
countryList.show();
If you look at my simple draw override, I am putting up a “say” dialog and not calling Super(). Running the above code, the “say” dialog in “draw” is fired and the grid isn’t drawn. However, if you uncomment the call to Super(), the “say” dialog is fired but the grid is drawn before you click “OK” in the “say” dialog? I have looked at the reference for the “say” dialog and it clearly specifies that it is modal but, the behaviour displayed when you uncomment the call the Super() suggests that “say” doesn’t actually block. If you can clarify what may be happening here, I would really appreciate it.
Finally, due to my unfamiliarity with JS, I was obviously able to override “draw” as per the above code. However, if you wanted to override something like “body.scrolled”, I am not sure how you would specify this in code? For example, the following code demonstrates the question but I know the implementation is incorrect:-
body.scrolled: function() {
this.Super('scrolled', arguments);
}
What does the JS look like to override a function that is hanging off another member like, in the above case, “body”?
Phew! Sorry about the length of this post.
BTW, as each bit sinks in, I am really starting to like this stuff 
Cheers
-H