DefaultWindowButtons extension

Hi all,

I just added a small window extension that will add Ok and Cancel buttons to your window, and adds some standard behaviour to these buttons.
It's also possible to add only a Close butten instead of the Ok and Cancel buttons.

The plus of this is that you do not have to retype these things for every window.
Small as the extension is, IMHO it also shows how to build extensions and how to use the event handlers.

Any comments, improvements and opinions are welcome as always.

NEW
I've added some functionality and updated the page to v0.91. There's one addition I still want to make before reaching v1.0, and that is to be able to add a Select button, which will return the selected record(s) from a grid in the window. I hope to do this soon.

Thanks for your reply. I was thinking about the same functionality that you mentioned. As all my windows are separate objects, I 'initialize' the url for example in the window, cause I feel that a window has one url it should fetch all data from and save all data to.
But it should be confurable, yes, as should be the params to send with the request.

But what do you intent with the success boolean in the 'afterClose' event? I'd think that a listener can prevent closing, submitting or canceling a window by returning false. But after the this.win.close() statement, the window is always closed I'd think.

Or do you mean to pass a boolean whether or not the window is successfully submitted?

But what do you intent with the success boolean in the 'afterClose' event? I'd think that a listener can prevent closing, submitting or canceling a window by returning false. But after the this.win.close() statement, the window is always closed I'd think.

The code that opens the window should have an option to know when the window has been closed, for example to refresh a grid. The success param will pass if the user has pressed cancel (false) or Ok (true)

I've updated the source more or less as you asked me. There's one more thing I want to add, I'll hope to do that later on.
This morning I couln't post the new version on the wiki, as it didn't allow me to make changes to the text. I asked the ext team to update the source for me or to tell me what the error means.

I want to add another 'Select' button, which can be used together with the Close button. It's meant to return one or more selected records if the window contains a grid. This will open up the possibility of using a lookup control which will open a window and will enable the user to select a record.