[Checkins]
SVN: zc.extjs/branches/dev/src/zc/extjs/resources/util.txt
Added some additional documentation of form_dialog that shows the
Jim Fulton
jim at zope.com
Mon Mar 31 11:11:15 EDT 2008
Log message for revision 85037:
Added some additional documentation of form_dialog that shows the
special care needed when using the result as a handler.
Changed:
U zc.extjs/branches/dev/src/zc/extjs/resources/util.txt
-=-
Modified: zc.extjs/branches/dev/src/zc/extjs/resources/util.txt
===================================================================
--- zc.extjs/branches/dev/src/zc/extjs/resources/util.txt 2008-03-31 15:11:12 UTC (rev 85036)
+++ zc.extjs/branches/dev/src/zc/extjs/resources/util.txt 2008-03-31 15:11:14 UTC (rev 85037)
@@ -105,15 +105,31 @@
Example::
- add_button = new Ext.Button({
+ var show_dialog = zc.extjs.util.form_dialog({
+ url: 'add_slot_form',
+ window_config: {title: 'Add slot', width: 500},
+ after: function () {
+ slot_tree.getRootNode().reload();
+ }
+ });
+ var add_button = new Ext.Button({
text: '+',
- handler: zc.extjs.form_dialog({
+ handler: function () {show_dialog()}
+ });
+
+Notice that we didn't use show_dialog as a handler directly. If we
+had, it would have been passed a button, which it wouldn't have
+expected. We could have used createDelegate instead:
+
+ var add_button = new Ext.Button({
+ text: '+',
+ handler: zc.extjs.util.form_dialog({
url: 'add_slot_form',
window_config: {title: 'Add slot', width: 500},
after: function () {
slot_tree.getRootNode().reload();
}
- })
+ }).createDelegate(this, [])
});
More information about the Checkins
mailing list