Skip to Content
0
May 22, 2013 at 09:51 AM

mutiple model bind to RadioButtonGroup

51 Views

...

var oModel = new sap.ui.model.json.JSONModel();

oModel.setData({

appTypes:[{skey:"P", stext:"岗位代理 "},

{skey:"R", stext:"角色代理 "}],

reasomTypes:[{skey:"A", stext:"公出 "},

{skey:"B", stext:"出差 "},

{skey:"C", stext:"请假 "},

{skey:"D", stext:"其它 "} ],

editable: true,

selectedIndex: 0

});

sap.ui.getCore().setModel(oModel,"myList");

//*********************************

// RadioButtonGroup

function LBSelect(oEvent){

var iIndex = oEvent.getParameter("selectedIndex");

oModel.setProperty("selectedIndex", iIndex);

};

var oRBGroup1 = new sap.ui.commons.RadioButtonGroup("RBGEntry1");

//oRBGroup1.setModel(oModel);

oRBGroup1.bindProperty("editable", "myList>/editable");

oRBGroup1.bindProperty("selectedIndex", "myList>/selectedIndex");

oRBGroup1.attachSelect(LBSelect);

var oItemTemplate1 = new sap.ui.core.Item();

oItemTemplate1.bindProperty("key", "skey");

oItemTemplate1.bindProperty("text", "stext");

//oItemTemplate1.bindProperty("enabled", "enabled");

oRBGroup1.bindItems("myList>/appTypes", oItemTemplate1);

oMatrix.createRow("代理类别", oRBGroup1,null);

//oPanel.addButton(b1);

oPanel.addContent(oMatrix);

...

data bind failed, Anybody help me ?

Thanks