This project is read-only.

ListBuilder Control Example

This example explains how to create a simple window with ListBuilder control, bind to the data and show on the screen.

See interactive example on http://www.redui.net

UI Model

{
    "windows": [
        {
            "name": "ListBuilderExample",
            "title": "ListBuilder Example",
            "left": 500,
            "top": 100,
            "width": 600,
            "height": 400,
            "controls": [
                {
                    "name": "countriesListBuilder",
                    "type": "listbuilder",
                    "label": "Countries",
                    "bindsTo": "countries",
                    "getOptionsFunction": "getcountries"
                },
                {
                    "name": "OKButton",
                    "type": "button",
                    "text": "OK",
                    "isDialogButton": true,
                    "dialogResult": "OK"
                },
                {
                    "name": "CancelButton",
                    "type": "button",
                    "text": "Cancel",
                    "isDialogButton": true,
                    "dialogResult": "Cancel"
                }
            ]
        }
    ]
}

Data Model

var addressData = {
	countries: [ "fr", "it" ]
};

Code

var countries = [
	{ id: "be", value: "Belgium", toString: function () { return this.value } },
	{ id: "fr", value: "France", toString: function () { return this.value } },
	{ id: "it", value: "Italy", toString: function () { return this.value } },
	{ id: "nl", value: "Netherlands", toString: function () { return this.value } }
];

redui.optionsBag.getcountries = function () {
	return countries;
};

var exampleWindow = redui.createNewWindow("ListBuilderExample");
exampleWindow.bind(addressData);
exampleWindow.show();


.

Last edited Feb 7, 2014 at 11:17 PM by artemkv, version 2

Comments

No comments yet.