手记

Learning Qooxdoo - 2

How to create a simple table?

There are two importent things exist in qooxdoo table class (qx.ui.table.Table) - Model and Selection.

 The model represents the columns and data of the table, and the selection is used to control single or multi-selection.

var model = new qx.ui.table.model.Simple();
model.setColumns(["ID", "User Name", "Sex", "Age"]);
model.setData([
    ['1', 'Zhangsan', 'man', 17],
    ['2', 'Lisi', 'man', 23],
    ['3', 'Wanger', 'man', 25],
    ['4', 'Mazi', 'man', 20],
    ['5', 'Chunhua', 'woman', 18]
]); 

var table = new qx.ui.table.Table(model);
table.set({
    width: 600,
    height: 400
}); 

table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.MULTIPLE_INTERVAL_SELECTION); 

this.getRoot().add(table, { left: 20, top: 50 });

0人推荐
随时随地看视频
慕课网APP