vendredi 30 octobre 2015

Add sap.ui.commons.CheckBox onto a sap.m.page

I'm new to SAPUI5 and want to make a page, with contains several CheckBoxes, based on SAPUI5. At this moment I have following code to create the CheckBoxes:

function chosevalues(){
        re_items = [];

        var items = [];
        var text = ["1070","1071","1072","1073","1074","1075","1076"];

        for (var i = 0; i < text.length; i++) {
            alert("in for with i= " + i);
            var box = new sap.ui.commons.CheckBox({
                                text : text[i],
                                tooltip : 'Value checkbox',
                                checked : false,
                                change : function() {
                                    if(oCB.getChecked()){
                                        alert(this.getText());
                                        re_items.push(this.getText());
                                    }else{
                                        alert('NO');
                                    }
                                }
                });
                items.push(box);
        }
        page4.addContent(items);
        app.to("page4");
    }

Now I place the array on the page-content, but the text and the boxes are very small. I tried with a sap.ui.table.Table and also with a sap.m.List. Nothing worked. It should be like this: SAPUI5 Explored - CheckBox But I found no way to include the mvc-view in my javascript code.

On the one hand I can programm with javascript to create the CheckBoxes like the example, and on the other hand I can try to include the mvc-view. The Problem is, that I have no idea for both.




Aucun commentaire:

Enregistrer un commentaire