1、AWC表格加上序号列的显示 (主要是数据如何处理)
export let getUserData = async function () { let userData = await getUserDataFromTC(); let objects = userData.objects; console.log("userData = "+userData); console.log("objects = " + objects); /** * 1、这种方式没有效果 */ // for (let index = 0; index < objects.length; index++) { // let indexStr = 0 + index + 1 + ''; // objects[index].props.index = { // "type": "STRING", // "hasLov": false, // "isArray": false, // "displayValue": indexStr, // "uiValue": indexStr, // "value": indexStr, // "propertyName": 'index', // "propertyDisplayName": 'index', // "isEnabled": false // } // objects[index].index = indexStr; // } /** * 2 这种方式可以 */ for (let index = 0; index < objects.length; index++) { let indexStr = 0 + index + 1 + ''; objects[index].props.index = { "dbValues":[indexStr], "uiValues":[indexStr] } } return { response: userData.objects, totalFound: userData.objects.length } }
2、viewModel 的修改
{ "name": "index", "displayName": "序号号", "propertyName":"index", "minWidth": 60, "width": 150, "isTableCommand": false },
3、最终显示效果