diff --git a/ui (gen4)/features/examples.js b/ui (gen4)/features/examples.js index a9e7aa4f..364c228a 100755 --- a/ui (gen4)/features/examples.js +++ b/ui (gen4)/features/examples.js @@ -921,6 +921,7 @@ var ExampleUIActions = actions.Actions({ exampleEditor2: ['Test/Universal Editor (2)...', widgets.makeUIDialog(function(spec, callback){ var that = this + var data = {} return browse.makeLister(null, function(path, make){ make([ @@ -934,11 +935,9 @@ var ExampleUIActions = actions.Actions({ return that.features.features.length }) make.field('A', 'B') - //make.field.field('C', 'D') - //make.field.field.field('E', 'F') - make.field.field.field.field('G', 'H') - make.field.Toggle('Toggle', 'on') + //make.field.Toggle('Toggle: ', 'on') + make.field.Toggle('Toggle: ', data) }, { cls: 'table-view', diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 20aa7d64..b5b5b783 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -658,8 +658,7 @@ var DialogsActions = actions.Actions({ .last() return modal.data('widget-controller') || (modal.length > 0 && modal) - || null - }, + || null }, // testers... // @@ -1059,13 +1058,28 @@ browse.items.makeSubContext('field', +// +// .field.Toggle(title, value) +// .field.Toggle(title, options) +// .field.Toggle(title, value, options) +// // XXX need to open a list dialog (currently context is used)... // ...this can be set via options.list but would be nice to provide // a reasonable default... +// ...one way to resole context access is to add a .app attribute to +// the dialog... browse.items.field.Toggle = -function(title, value, options){ +function(title, options){ var that = this - options = options || {} + // parse args... + var args = [...arguments].slice(1) + var value = args[0] instanceof Object ? + (args[0].value + || (args[0].values || [])[0] + || 'off') + : args.shift() + options = args.shift() || {} + return this.field(title, value, Object.assign( options,