Hi Martin,
I tried to prepare a small playground example but I cannot shorten the url
Here is my example code (But I have trouble with the controller )
if you change the value in the textfiled from 1 to 5 and click then on
"reset" nothing happens
So I assume we need an Form Tag orde lement like
var inputForm = new qx.ui.form.Form(); ??
------------------------------------------------------
var doc = this.getRoot();
var resetter = new qx.ui.form.Resetter();
var modelSkeleton = {copies: "1", printoption: null, collate: ""};
/*
var model = qx.data.marshal.Json.createModel(modelSkeleton);
// create the controller
var controller1 = new qx.data.controller.Object(model);
controller1.addTarget(this.txtCopies, "value", "copies", true);
controller1.addTarget(selectBoxPrintOption, "value", "deadline", true);
//controller.addTarget(ChkSort, "value", "collate", true);
*/
var txtCopies = new qx.ui.form.TextField("1").set({
maxLength: 15,
textAlign: "center",
width: 50,
height: 40
});
txtCopies.focus();
txtCopies.addListener("changeValue", function(e) {
this.debug("ChangeValue: " + e.getData());
}, this);
doc.add(txtCopies,
{
left : 50,
top : 20
});
var selectBoxPrintOption = new qx.ui.form.SelectBox();
selectBoxPrintOption.setWidth(150);
/*
var data = [{label: this.tr("Simplex"), id: "Simplex", icon: ""},
{label: this.tr("Duplex (long edge)"), id: "DuplexLongEdge", icon: ""},
{label: this.tr("Duplex (short edge)"), id: "DuplexShortEdge", icon: ""},
{label: this.tr("Booklet"), id: "Booklet", icon: ""}];
var model = qx.data.marshal.Json.createModel(data);
var controller = new qx.data.controller.List(null,
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);
*/
doc.add(selectBoxPrintOption,
{
left : 50,
top : 70
});
// Create a button
var button1 = new qx.ui.form.Button("Reset",
"icon/22/apps/internet-web-browser.png");
// Document is the application root
// Add button to document at fixed coordinates
doc.add(button1,
{
left : 50,
top : 100
});
// Add an event listener
button1.addListener("execute", function(e) {
resetter.reset();
});
---------------------------------------------------------
2011/8/15 Martin Wittemann <[email protected]>
> Hi,
> but selectboxes, right? Those are form elements which could be used with
> the resetter. Could you maybe supply a playground sample which shows what
> you want to reset?
> Regards,
> Martin
>
>
> Am 15.08.2011 um 13:47 schrieb Hansjoerg Schock:
>
> Hi Martin,
>
> hmm, but if I understand it right, you need a Form element or Form class.
> I do not use a Form in the moment.
>
> regards
> Hansjoerg
>
> 2011/8/15 Martin Wittemann <[email protected]>
>
>> Hey,
>> no not at all. The resetModel is a generated method for the model property
>> which basically only removes the model from the controller. Thats not really
>> what you want, right?
>> I was talking about that class:
>> http://demo.qooxdoo.org/current/apiviewer/#qx.ui.form.Resetter
>> Regards,
>> Martin
>>
>> Am 15.08.2011 um 13:14 schrieb Hansjoerg Schock:
>>
>> Hi Martin,
>>
>> thanks a lot for the quick reply,
>> In the moment I have wrote this post, I saw in the Api viewer the method
>> "resetModel();"
>>
>> I did it in this way and it works.
>>
>> this.controller.resetModel();
>>
>> Is this what you mean with "resetter"m ?
>>
>> kind regards
>> Hansjoerg
>>
>>
>>
>> 2011/8/15 Martin Wittemann <[email protected]>
>>
>>> 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
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>>
>>
>
> ------------------------------------------------------------------------------
> 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
>
>
------------------------------------------------------------------------------
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