smartgwt的Listgrid具有显示行号的功能.我尝试将它用于小桌子,它就像一个魅力.
但对于行数大于9999的表,"行号"列不会显示多于4个数字.

所以,这是一个问题.如何使Listgrid显示"行号"列中的所有数字?
我的测试网格:
ListGrid listGrid=new ListGrid();
listGrid.setWidth(300);
listGrid.setHeight(200);
ListGridField name = new ListGridField("name", "Name");
listGrid.setFields(name);
listGrid.setShowRowNumbers(true);
Record[] records=new Record[10000];
for (int i=0; i<records.length; i++){
Map<String, String> map=new HashMap<String, String>();
map.put("name", "Hello");
records[i]=new Record(map);
}
listGrid.setData(records);
listGrid.setAutoFitData(Autofit.HORIZONTAL);
Run Code Online (Sandbox Code Playgroud)
看一下这个。您将能够更改宽度。
代码应该是这样的
ListGridField rowNumberField = new ListGridField();
// Either
//-------------------------------------------------------
rowNumberField.setWidth(15); //Whatever width you want
//-------------------------------------------------------
// Or
//-------------------------------------------------------
rowNumberField.setAutoFitWidth(true);
//-------------------------------------------------------
ListGrid listGrid = new ListGrid();
listGrid.setRowNumberFieldProperties(rowNumberField);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1608 次 |
| 最近记录: |