While writing the post, I got an idea: would it be a proper way, to create a
wrapping class for the value to bind which contains the method so it can be
called in converter?

My Real-World-example which is working (with Date instead of int, sorry for
the confusion):

qx.Class.define("mkss.data.DateWrapper", {
    extend: qx.core.Object,
    properties: {
        date: {
            check: "Date"
        }
    },
    construct: function (date, format) {
        this.base(arguments);        
        this.setDate(date);        
        this.dateFormat = new qx.util.format.DateFormat(format);
    },
    members: {        
        getFormattedDate: function () {
            return this.dateFormat.format(this.getDate());
        }
    }
});

The gameData-object I'm using next has a date-property like this:

qx.Class.define("mkss.data.GameData",
{
    extend: qx.core.Object,
    properties: {
        date: {
            check: "Date",
            init: new mkss.data.DateWrapper(new Date("1980-01-01"),
"d.M.y"),
            event: "changeDate"
        }, ...
     }
});

And in the displaying widget the binding happens like this:

        var lblDate = new qx.ui.basic.Label();
        this.bind("gameData.date", lblDate, "value", {
            converter: function (data) {              
                return data.getFormattedDate();
            }
        });
        this.add(lblDate);

Would you think this is a way to go?



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Is-it-possible-to-add-another-object-to-the-converter-for-a-singlevalue-binding-tp7588266p7588267.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to