Current official implementation for list view data loading requires at least two iterations to complete full data population. For basic list data rendering, manually iterating through each row/column for value assignment is fundamentally redundant. We recommend the framework team optimize view list data binding mechanisms with batch processing capabilities. ![]()
function loadListView(){
var listView = $.xdlg.Control("listview1");
var dataList = $.getDataList();
try{
// 第一种:视图列表批量加载多行数据绑定,只需一行代码
// Option 1: Implement batch data loading for list views with a single-line solution.
listView.data = dataList;
// return true;
for(var i = 0; i < dataList.length; i++){
var rdata = dataList[i];
var items = listView.GetItemAt(listView.AddItem(rdata[0]));
// 第二种:视图列表加载单行数据,禁止使用循环
// Option 2: Implement single-row data binding for list views using declarative patterns (loop-free approach).
items.subitems = rdata;
// 原始数据加载方式,需要循环 N 次
// With the original data loading method, it is necessary to perform N loops.
/*
for(var d = 1; d < rdata.length; d++){
//$.xlog(rdata[d]);
items.subitems(d-1) = rdata[d];
}
*/
var cell3 = items.subitems(2);
if(String(cell3).search("/08/") > 0){
cell3.fg("#3099ff");
cell3.styles("u", "b");
//cell3.styles("b", "i", "u");
//cell3.styles("u");
}
var cell5 = items.subitems(4);
//$.xlog(cell5);
if(Number(cell5) > 2000){
cell5.fg("#FFFFFF");
cell5.bg("#FF0000");
cell5.styles("b");
}
}
listView.columns.AutoSize();
}catch(err){
$.xlog("error message: " + err.message);
}
}
function getDataList(){
var datas = [
[1001, "PRO-SHA", "UW-F20-10", "2005/07/01", "45.2", "1500", "N", "200", "v1.3.13"],
[2001, "PRO-SHA", "UW-F20-11", "2006/06/12", "40.23", "2343", "Y", "343", "v2.5.1"],
[3001, "PRO-SHA", "UW-F20-12", "2006/08/20", "53.39", "1120", "Y", "90", "v1.4.22"],
[4001, "PRO-SHB", "UW-K45-S4", "2007/05/23", "58.9", "300", "N", "10", "v2.8.0"],
[5001, "PRO-SHB", "UW-K09-G5", "2008/03/13", "60.33", "532", "Y", "20", "v4.6.1"],
[6001, "PRO-SHB", "UW-K21-R3", "2008/09/14", "64.78", "1430", "N", "180", "v1.1.19"],
[7001, "PRO-SHC", "UW-J33-56", "2010/04/28", "67.45", "2800", "Y", "520", "v7.12.04"],
[8001, "PRO-SHC", "UW-J52-24", "2011/08/19", "70.49", "3740", "Y", "940", "v9.15.08"],
[9001, "PRO-SHC", "UW-J63-39", "2013/01/04", "70.14", "5999", "Y", "1260", "v11.9.03"],
[10001, "PRO-SHC", "UW-J89-75", "2013/11/16", "67.78", "7810", "Y", "2790", "v11.12.03"]
];
return datas;
}