- If an empty string is assigned to any element on a row, it will crash PXCE if you select that row;
- It's not possible to set a row as selected when loading the table. It seems to ignore Select: true
The following dialog should have the row with Title "Definitions" selected, and if you select the row below that (empty title) it will crash the program:
Code: Select all
// sample multi column list view
{
const dialogObject = {
results: {},
initialize (dialog) {
dialog.load(
{
"dia1": this.results,
});
},
commit (dialog) {
var elements = dialog.store();
this.results = this.getMCLVrow( elements["dia1"]);
},
// handler for the MCLV
dia1 (dialog) {
const row = this.getMCLVrow( dialog.store()["dia1"] );
app.alert("Chapter: " + row.chapter + "\n Section: " + row.section + "\n Sub-section: " + row.sub + "\n Title: " + row.title);
},
// returns the selected row in a MCLV
getMCLVrow( mclv ) {
for (var i = 0; i < mclv.aRows.length; i++) {
const row = mclv.aRows[i];
// property .Select is true if selected
if (row.Select) return row;
}
},
description: {
name: "Sample Multi Column List View", elements: [
{ type: "mclv", item_id: "dia1", width: 400, height: 200 },
{ type: 'ok_cancel'}]
}
};
/* data for the multi-column list view is an object with two properties aColmns and aRows
* aColumns is an array of columns. Each column has properties
* Name (the property id to use in the rows),
* UI (the displayed text),
* width ( _proportion_ that this column should take of overall width),
* Justification (I can't get this to work, so I don't know what properties of this do)
* aRows is an array with each item being an object with the properties defined in aColumns
*/
dialogObject.results = {
aColumns: [
{ Name: 'chapter', UI: "Chapter", width: 0.1},
{ Name: 'section', UI: "Section", width: 0.1},
{ Name: 'sub', UI: "Sub Section", width: 0.1},
{ Name: 'title', UI: "Title", width: 0.7}
],
aRows: [
{ chapter: 1, section: 1, sub: 1, title: "SCOPE"},
{ chapter: 1, section: 2, sub: 1, title: "Definitions", Select: true}, // this row should be selected
{ chapter: 1, section: 3, sub: 2, title: ""}, // empty string will crash
{ chapter: 1, section: 3, sub: 3, title: "As-Built Information"},
]
};
// run the dialog
app.execDialog( dialogObject);
// this is what the MCLV returns from dialog.store();
console.println(JSON.stringify(dialogObject.results, null, 2));
}