SAPUI5

데이터 바인딩 할 때 할 수 잇는 오류

선즈반 2014. 12. 31. 09:36

SAPUI5에서 가장 빈번하게 하는 작업이 데이터 바인딩 작업인거 같다. 이런 빈번하게 일어나는 작업에서 실수가 있게 마련......  

데이터를 바인딩하는 하나의 객체를 다른 두개의 객체에 넣어줬을 때 데이터를 인식하지만 데이터가 표시되지 않을 수 있다. 예를 들어 textview 객체를 만들고 모델을 바인딩한 후 MatrixLayout과 Table에 각각 넣어주줬을 경우 둘 중 하나에서데이터가 표시되지 않는다.

var oSampleTV = new sap.ui.commons.TextView();

var oSampleML = new sap.ui.layout.MatrixLayout();


var oRow = new sap.ui.commons.layout.MatrixLayoutRow();

oSampleML .addRow(oRow);


var oCell = new sap.ui.commons.layout.MatrixLayoutCell();

oCell.addContent(oSampleTV );


oRow.addCell(oCell);

oSampleML .addRow(oRow);


var oSampleTable = new sap.u.table.Table();

oSampleTable .addColumn(new sap.ui.table.Column({

label: new sap.ui.commons.Label({text: "Text"}),

template: new sap.ui.commons.CheckBox().bindProperty("checked", "checked"),

sortProperty: "checked",

filterProperty: "checked",

width: "200px",

hAlign: "Center"

}));