Hey,
we have a dedicated class for that which is called Resetter and can be found in
the form namespace of ui. You can add all your selectboxes to it and after the
send, just call the reset method and you are done. If you would use a from, the
resetter is already integrated in that and can be used the same way.
But setting the selection should work also. You just have to keep in mind that
you have to use the same object that you have set as model and not the string
which is shown in the selectbox.
Regards,
Martin
Am 15.08.2011 um 13:01 schrieb hjschock:
> Hello,
>
> A User can choose and select some items from selectBoxes and fill in values
> in text fields.
> After selection the user clicks on "Send" and all items will be send to
> database.
>
> My code:
> ---------------------------------------
> var modelSkeleton = {copies: "1", printoption: null, deadline: "", collate:
> ""};
> var model = qx.data.marshal.Json.createModel(modelSkeleton);
> // create the controller
> this.controller = new qx.data.controller.Object(model);
> // connect the copies
> this.controller.addTarget(this.__txtCopies, "value", "copies", true);
> // connect the deadline
> this.controller.addTarget(this.__txtDeadline, "value", "deadline", true);
> // connect the select box Printoption
> this.controller.addTarget(this.__selectBoxPrintOption, "modelSelection[0]",
> "printoption", true);
> this.controller.addTarget(this.__ChkSort, "value", "collate", true);
>
> ..
> this.__selectBoxPrintOption = new qx.ui.form.SelectBox();
> this.__selectBoxPrintOption.setWidth(150);
> var data = [{label: this.tr("Simplex"), id: "Simplex", icon:
> "mobilewebjobticket/simplex.png"}, {label: this.tr("Duplex (long edge)"),
> id: "DuplexLongEdge", icon: "mobilewebjobticket/duplex_long_edge_24.png"},
> {label: this.tr("Duplex (short edge)"), id: "DuplexShortEdge", icon:
> "mobilewebjobticket/duplex_short_edge_24.png"}, {label: this.tr("Booklet"),
> id: "Booklet", icon: "mobilewebjobticket/booklet_24.png"}];
> var model = qx.data.marshal.Json.createModel(data);
> var controller = new qx.data.controller.List(null,
> this.__selectBoxPrintOption, "label");
> controller.setDelegate({bindItem : function(controller, item, id) {
> controller.bindDefaultProperties(item, id);
> controller.bindProperty("id", "model", null, item, id);
> }});
> controller.setIconPath("icon");
> controller.setModel(model);
> ---------------------------------------------------
>
> How can I reset all SelectBoxes, Checkboxes and Textfields after sending?
>
> I tried it like in the demo browser example
> http://demo.qooxdoo.org/current/demobrowser/#data~SelectBox.html
>
> like
> this.controller.getSelection().setItem(0, "C");
> but this does not work for me.
>
> thanks for any help.
>
> kind regards
> Hansjoerg
>
>
>
>
>
>
> --
> View this message in context:
> http://qooxdoo.678.n2.nabble.com/reset-set-SelectBox-tp6687060p6687060.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at: http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel