{ "custom": { "filter_menu_data": [ { "filters": [ { "color": "#8B008B", "column": "test1", "group": 1, "id": 0, "text": "value1" } ], "group_name": "test1", "instancePosition": {}, "instanceStyle": { "classes": "" } }, { "filters": [ { "color": "#00CED1", "column": "test2", "group": 2, "id": 1, "text": "value2" } ], "group_name": "test2", "instancePosition": {}, "instanceStyle": { "classes": "" } } ], "filtered_table_data": [], "filters": { "active": [], "default_colors": [ "#8B008B", "#00CED1", "#FF8C00", "#708090", "#DC143C", "#FFDEAD", "#7B68EE", "#4169E1", "#F4A460", "#9ACD32" ], "number_of_groups": "value", "selection_active": false }, "table_data": [], "use_filtered_table": false }, "params": { "DoubleClick": { "Enabled": false, "MP": "MP", "Sts": "STATUS", "TextCode": "TEXT_CODE", "WHID": "WHID" }, "NavigationSettings": { "BaseUrl": "", "Column": "", "Enabled": false }, "SelectedRow": [], "VisibleColCount": 5, "filters": [ { "column": "test1", "group": 1, "text": "value1" }, { "column": "test2", "group": 2, "text": "value2" } ], "header_order": [ "timestamp", "username", "operation", { "field": "destination_bucket", "visible": true }, "destination_site", "destination_view", { "field": "destination_object_key", "visible": false }, { "field": "destination_version_id", "visible": false }, "expires", { "field": "source_bucket", "visible": true }, "source_site", "source_view", { "field": "source_object_key", "visible": false }, { "field": "source_version_id", "visible": false }, { "field": "response", "visible": false }, "error_occurred", { "field": "error_message", "visible": true }, { "field": "audit_id", "visible": false }, { "field": "copy_option", "visible": false }, { "field": "ttl", "visible": false } ], "key_to_read_from": "use_param", "puToDismiss": "", "table_data": [], "title": "S3 SCADA Audit Logs" }, "propConfig": { "custom.filter_menu_data": { "binding": { "config": { "path": "view.custom.filters.deactive" }, "transforms": [ { "code": "\tinstances \u003d []\n\tgroups \u003d {}\n\tfor filter in value:\n\t \tif not groups.has_key(filter.column):\n\t \t\tgroups[filter.column] \u003d []\n\t \tgroups[filter.column].append(filter)\n\tfor key in groups:\n\t\tinstance \u003d {\"instanceStyle\": {\n\t \t\t\t\"classes\": \"\"},\n\t \t\t\t \"instancePosition\": {}}\n\t \tgroups[key].sort()\n\t \tinstance[\u0027filters\u0027] \u003d groups[key]\n\t \tinstance[\u0027group_name\u0027] \u003d key\n\t \tinstances.append(instance)\n\treturn instances", "type": "script" } ], "type": "property" }, "persistent": true }, "custom.filtered_table_data": { "binding": { "config": { "expression": "if({view.custom.table_data} !\u003d {view.custom.filters.active},\r\n{view.custom.filters.active},\r\n{view.custom.filters.active})" }, "transforms": [ { "code": "\tfiltered_table \u003d []\n\tif len(value) \u003e 0:\n\t\tfilter_lookup \u003d {}\n\t\tfor act_filter in value:\n\t\t\tif act_filter[\u0027column\u0027] not in filter_lookup:\n\t\t\t\tfilter_lookup[act_filter[\u0027column\u0027]] \u003d []\n\t\t\tfilter_lookup[act_filter[\u0027column\u0027]].append(act_filter[\u0027text\u0027])\n\t\tfor row in self.custom.table_data:\n\t\t\tsystem.perspective.print(row)\n\t\t\tshould_filter \u003d {}\t\t\n\t\t\t# Handles stylized rows\t\n\t\t\tif \u0027style\u0027 in row and \u0027value\u0027 in row and len(row) \u003d\u003d2:\n\t\t\t\t#for column in row:\n\t\t\t\t\t#system.perspective.print(\u0027value:%s\u0027%column)\n\t\t\t\t\tdata_columns \u003d row[\u0027value\u0027]\n\t\t\t\t\tfor s_column in data_columns:\n\t\t\t\t\t\tif s_column in filter_lookup:\n\t\t\t\t\t\t\tif data_columns[s_column] in filter_lookup[s_column]:\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tshould_filter[s_column] \u003d True\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\tshould_filter[s_column] \u003d False\n\t\t\t\t\t\telse:\n\t\t\t\t\t\t\tshould_filter[s_column] \u003d False\t\n\t\t\telse:\n\t\t\t\tfor column in row:\n\t\t\t\t\tif column in filter_lookup:\n\t\t\t\t\t\tif row[column] in filter_lookup[column]:\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tshould_filter[column] \u003d True\n\t\t\t\t\t\telse:\n\t\t\t\t\t\t\tshould_filter[column] \u003d False\n\t\t\t\t\telse:\n\t\t\t\t\t\tshould_filter[column] \u003d False\n\t\t\tif sum(should_filter.values()) \u003d\u003d len(filter_lookup.keys()):\n\t\t\t\tfiltered_table.append(row)\n\n\treturn filtered_table", "type": "script" } ], "type": "expr" }, "persistent": true }, "custom.filters": { "persistent": true }, "custom.filters.deactive": { "binding": { "config": { "path": "view.params.filters" }, "transforms": [ { "code": "\t\n\tfilters \u003d []\n\tgroups \u003d []\n\tfor index, filter in enumerate(value):\n\t\tnew_filter \u003d {}\t\n\t\tif not filter.has_key(\u0027group\u0027):\n\t\t\tnew_filter[\u0027group\u0027] \u003d 0\n\t\telse:\n\t\t\tnew_filter[\u0027group\u0027] \u003d filter.group\n\t\tif not filter.has_key(\u0027color\u0027):\n\t\t\tif new_filter[\u0027group\u0027] not in groups:\n\t\t\t\tgroups.append(new_filter[\u0027group\u0027])\n\t\t\tnew_filter[\u0027color\u0027] \u003d self.custom.filters.default_colors[groups.index(new_filter[\u0027group\u0027])]\n\t\telse:\n\t\t\tnew_filter[\u0027color\u0027] \u003d filter.color\n\t\tif not filter.has_key(\u0027text\u0027):\n\t\t\tnew_filter[\u0027text\u0027] \u003d \u0027Filter \u0027 + str(index)\n\t\telse:\n\t\t\tnew_filter[\u0027text\u0027] \u003d filter.text\n\t\tif not filter.has_key(\u0027column\u0027):\n\t\t\tnew_filter[\u0027column\u0027] \u003d 0\n\t\telse:\n\t\t\tnew_filter[\u0027column\u0027] \u003d filter.column\n\t\tnew_filter[\u0027id\u0027] \u003d index\n\t\tfilters.append(new_filter)\t\t\t\t\n\treturn filters", "type": "script" } ], "type": "property" } }, "custom.table_data": { "binding": { "config": { "expression": "if({view.params.key_to_read_from} \u003d \u0027use_param\u0027,\r\n{view.params.table_data},\r\nproperty(concat(\u0027session.custom.tableComponentData.\u0027,{view.params.key_to_read_from})))" }, "type": "expr" }, "persistent": true }, "custom.use_filtered": { "persistent": true }, "custom.use_filtered_table": { "binding": { "config": { "path": "view.custom.filtered_table_data" }, "transforms": [ { "code": "\treturn len(value) \u003e 0", "type": "script" } ], "type": "property" }, "persistent": true }, "params.DoubleClick": { "paramDirection": "input", "persistent": true }, "params.NavigationSettings": { "paramDirection": "input", "persistent": true }, "params.SelectedRow": { "binding": { "config": { "path": "/root/Table.props.selection.data" }, "type": "property" }, "paramDirection": "output", "persistent": true }, "params.VisibleColCount": { "paramDirection": "input", "persistent": true }, "params.filters": { "paramDirection": "input", "persistent": true }, "params.header_order": { "paramDirection": "input", "persistent": true }, "params.key_to_read_from": { "paramDirection": "input", "persistent": true }, "params.puToDismiss": { "paramDirection": "input", "persistent": true }, "params.table_data": { "paramDirection": "input", "persistent": true }, "params.title": { "paramDirection": "input", "persistent": true } }, "props": { "defaultSize": { "height": 844 } }, "root": { "children": [ { "children": [ { "children": [ { "meta": { "name": "Title" }, "position": { "basis": "100%" }, "propConfig": { "props.text": { "binding": { "config": { "path": "view.params.title" }, "type": "property" } } }, "props": { "style": { "classes": "Title/Text", "fontSize": 14, "overflow": "visible" } }, "type": "ia.display.label" } ], "meta": { "name": "Title" }, "position": { "basis": "50%" }, "props": { "style": { "fontSize": 1, "marginLeft": 10, "overflow": "visible" } }, "type": "ia.container.flex" }, { "children": [ { "meta": { "name": "FilterCheck", "tooltip": { "enabled": true, "location": "top-left", "text": "Enable Table Search" } }, "position": { "basis": "108px" }, "propConfig": { "position.display": { "binding": { "config": { "expression": "LEN({..../Table.props.data})\u003e0" }, "type": "expr" } } }, "props": { "checkedIcon": { "style": { "fontSize": 16 } }, "indeterminateIcon": { "style": { "fontSize": 16 } }, "style": { "fontSize": 12 }, "text": "Search?", "textPosition": "left", "uncheckedIcon": { "style": { "fontSize": 16 } } }, "type": "ia.input.checkbox" }, { "meta": { "name": "Spacer1" }, "position": { "basis": "1px" }, "props": { "style": { "classes": "General/Divider" } }, "type": "ia.container.flex" }, { "events": { "dom": { "onClick": { "config": { "script": "\ttable \u003d self.parent.parent.parent.getChild(\"Table\")\n\t# ignition perspective has a bug with table where the only way to \n\t# actually de-select and remove the row highlight is to set the\n\t# row and column to -1 and THEN None\n\t# this will automatically clear the selection.data array\n\ttable.props.selection.selectedRow \u003d -1\n\ttable.props.selection.selectedColumn \u003d -1\n\ttable.props.selection.selectedRow \u003d None\n\ttable.props.selection.selectedColumn \u003d None" }, "scope": "G", "type": "script" } } }, "meta": { "name": "ClearSelectionButton", "tooltip": { "enabled": true, "location": "top-left", "text": "Clear Selection" } }, "position": { "basis": "31px" }, "propConfig": { "position.display": { "binding": { "config": { "expression": "len({..../Table.props.selection.data})\u003e0" }, "type": "expr" } } }, "props": { "path": "material/clear", "style": { "classes": "General/Button" } }, "type": "ia.display.icon" }, { "meta": { "name": "Spacer2" }, "position": { "basis": "1px" }, "propConfig": { "position.display": { "binding": { "config": { "path": "../ClearSelectionButton.position.display" }, "type": "property" } } }, "props": { "style": { "classes": "General/Divider" } }, "type": "ia.container.flex" }, { "events": { "dom": { "onClick": { "config": { "draggable": false, "id": "ColumnSelection", "modal": true, "overlayDismiss": true, "position": { "relativeLocation": "bottom-left" }, "positionType": "relative", "resizable": true, "showCloseIcon": true, "type": "toggle", "viewParams": { "Columns": "{/root/TableHeader/TableActions/ColumnSelectionButton.custom.Columns}" }, "viewPath": "Objects/PowerTable/ColumnSelection", "viewportBound": false }, "scope": "C", "type": "popup" } } }, "meta": { "name": "ColumnSelectionButton", "tooltip": { "enabled": true, "location": "top-left", "text": "+/- Columns" } }, "position": { "basis": "29px" }, "propConfig": { "custom.Columns": { "binding": { "config": { "path": "..../Table.props.columns" }, "transforms": [ { "code": "\tcolumns \u003d {}\n\tif len(value) \u003e 0:\n\t\tfor column in value:\n\t\t\t#field \u003d column.field\n\t\t\tfield \u003d column.header.title\n\t\t\tif field \u003d\u003d \u0027\u0027:\n\t\t\t\tfield \u003d \u0027None\u0027\n\t\t\tcolumns[field] \u003d column.visible\n\treturn columns", "type": "script" } ], "type": "property" } }, "position.display": { "binding": { "config": { "expression": "LEN({..../Table.props.data})\u003e0" }, "type": "expr" } } }, "props": { "path": "material/view_column", "style": { "classes": "General/Button", "fontSize": 12, "marginBottom": 5, "marginTop": 5 } }, "type": "ia.display.icon" }, { "meta": { "name": "Spacer4" }, "position": { "basis": "1px" }, "propConfig": { "position.display": { "binding": { "config": { "expression": "LEN({..../Table.props.data})\u003e0" }, "type": "expr" } } }, "props": { "style": { "classes": "General/Divider" } }, "type": "ia.container.flex" }, { "events": { "dom": { "onClick": { "config": { "script": "\tself.view.custom.filters.selection_active \u003d not self.view.custom.filters.selection_active" }, "scope": "G", "type": "script" } } }, "meta": { "name": "FilterButton", "tooltip": { "enabled": true, "location": "top-left", "text": "Filter Table" } }, "position": { "basis": "29px", "display": false }, "props": { "path": "material/filter_list", "style": { "classes": "General/Button", "fontSize": 12, "marginBottom": 5, "marginTop": 5 } }, "type": "ia.display.icon" }, { "meta": { "name": "Spacer3" }, "position": { "basis": "1px" }, "props": { "style": { "classes": "General/Divider" } }, "type": "ia.container.flex" }, { "events": { "dom": { "onClick": { "config": { "script": "\n\tcsv_headers \u003d []\n\tcsv_data \u003d []\n\tsystem.perspective.print(\u0027DOWNLOADING TABLE DATA\u0027)\n\tsource_data \u003d self.parent.parent.parent.getChild(\"Table\").props.data\n\theaders \u003d source_data[0].keys()\n\t\n\tif \u0027style\u0027 in headers and \u0027value\u0027 in headers and len(headers) \u003d\u003d 2:\n\t\tdata \u003d [row[\u0027value\u0027] for row in source_data]\n\telse:\n\t\tdata \u003d source_data\n\t\t\n\tfor record in data:\n\t\tif len(csv_headers) \u003d\u003d 0:\n\t\t\tcsv_headers \u003d record.keys()\n\t\t\tcsv_headers.sort()\n\t\t\tcsv_headers \u003d [str(i) for i in csv_headers]\n\t\tcsv_row \u003d []\n\t\tfor index in range(len(record)):\n\t\t\tcsv_row.append(str(record[csv_headers[index]]))\n\t\tcsv_data.append(csv_row)\n\t\n\ttry:\n\t\tcsv_dataset \u003d system.dataset.toDataSet(csv_headers, csv_data)\n\texcept Exception, e:\n\t\tsystem.perspective.print(str(e))\n\tcsv_export \u003d system.dataset.toCSV(csv_dataset)\n\tfilename \u003d \u0027{0}.csv\u0027.format(str(system.date.now()).replace(\u0027 \u0027, \u0027_\u0027))\n\tsystem.perspective.download(filename, csv_export)\n\t\n\tsystem.perspective.print(\u0027DONE DOWNLOADING TABLE DATA\u0027)" }, "scope": "G", "type": "script" } } }, "meta": { "name": "SettingsButton", "tooltip": { "enabled": true, "location": "top-left", "text": "Download Table Contents" } }, "position": { "basis": "30px" }, "propConfig": { "position.display": { "binding": { "config": { "expression": "LEN({..../Table.props.data})\u003e0" }, "type": "expr" } } }, "props": { "path": "material/cloud_download", "style": { "classes": "General/Button", "marginRight": 10 } }, "type": "ia.display.icon" } ], "meta": { "name": "TableActions", "tooltip": { "location": "top-right" } }, "position": { "grow": 1 }, "props": { "justify": "flex-end" }, "type": "ia.container.flex" } ], "meta": { "name": "TableHeader" }, "position": { "shrink": 0 }, "props": { "justify": "space-between", "style": { "borderBottomStyle": "solid", "borderBottomWidth": 1, "cursor": "pointer" } }, "type": "ia.container.flex" }, { "children": [ { "meta": { "name": "FilterMenu" }, "position": { "grow": 1 }, "propConfig": { "props.instances": { "binding": { "config": { "path": "view.custom.filter_menu_data" }, "type": "property" } } }, "props": { "alignContent": "flex-start", "alignItems": "flex-start", "path": "Objects/PowerTable/FilterMenuGroup", "style": { "overflow": "visible" }, "useDefaultViewHeight": false, "useDefaultViewWidth": false, "wrap": "wrap" }, "type": "ia.display.flex-repeater" } ], "meta": { "name": "FilterSelection" }, "position": { "grow": 1 }, "propConfig": { "position.display": { "binding": { "config": { "path": "view.custom.filters.selection_active" }, "type": "property" } } }, "props": { "style": { "borderBottomStyle": "solid", "borderBottomWidth": 1, "classes": "Menu/Menu", "overflow": "visible", "paddingLeft": 10, "paddingRight": 10 } }, "type": "ia.container.flex" }, { "children": [ { "children": [ { "meta": { "name": "FiltersLabel" }, "position": { "basis": "80px" }, "propConfig": { "props.text": { "binding": { "config": { "path": "view.custom.filters.active" }, "transforms": [ { "code": "\t\n\treturn \u0027\u0027.join([\u0027FILTERS (\u0027, str(len(value)), \u0027):\u0027])", "type": "script" } ], "type": "property" } } }, "props": { "style": { "classes": "Menu/Menu Page/Text", "fontSize": 10, "textAlign": "center" } }, "type": "ia.display.label" }, { "meta": { "name": "FiltersCarousel" }, "propConfig": { "props.views": { "binding": { "config": { "path": "view.custom.filters.active" }, "transforms": [ { "code": "\n\tviews \u003d []\n\tfor filter in value:\n\t\tcarousel_view \u003d {\n\t\t\t\u0027viewPath\u0027:\u0027Components/PowerTable/FilterTile\u0027,\n\t\t\t\u0027direction\u0027 : \u0027row\u0027,\n\t\t\t\u0027viewParams\u0027: {},\n\t\t\t\u0027justify\u0027:\u0027flex-start\u0027,\n\t\t\t\u0027alignItems\u0027: \u0027center\u0027}\n\t\tcarousel_view[\u0027viewParams\u0027][\u0027color\u0027] \u003d filter[\u0027color\u0027]\n\t\tcarousel_view[\u0027viewParams\u0027][\u0027text\u0027] \u003d filter[\u0027text\u0027]\t\n\t\tcarousel_view[\u0027viewParams\u0027][\u0027id\u0027] \u003d filter[\u0027id\u0027]\t\n\t\t\n\t\tviews.append(carousel_view)\n\treturn views", "type": "script" } ], "type": "property" } } }, "props": { "appearance": { "arrows": { "next": { "style": { "marginRight": 5 } }, "previous": { "style": { "marginLeft": 5 } } }, "dots": { "enabled": false }, "slidePadding": 3, "slidesToShow": 5, "useDefaultViewHeight": true, "useDefaultViewWidth": true }, "style": { "overflow": "visible", "textAlign": "left" } }, "type": "ia.display.carousel" } ], "meta": { "name": "Left" }, "position": { "basis": "90%" }, "props": { "style": { "overflow": "visible" } }, "type": "ia.container.flex" }, { "children": [ { "events": { "component": { "onActionPerformed": { "config": { "script": "\tself.view.custom.filters.active \u003d []\n\tsystem.perspective.sendMessage(\u0027deactivate-filter\u0027, payload \u003d {\u0027id\u0027:-1}, scope \u003d \u0027page\u0027)" }, "scope": "G", "type": "script" } } }, "meta": { "name": "ClearButton" }, "position": { "basis": "51px" }, "props": { "primary": false, "style": { "classes": "Menu/Item", "fontSize": 12, "marginBottom": 5, "marginLeft": 5, "marginRight": 5, "marginTop": 5 }, "text": "Clear", "textStyle": { "classes": "Page/Text" } }, "type": "ia.input.button" } ], "meta": { "name": "Right" }, "position": { "basis": "10%" }, "props": { "justify": "flex-end", "style": { "overflow": "visible" } }, "type": "ia.container.flex" } ], "meta": { "name": "Filters" }, "position": { "shrink": 0 }, "propConfig": { "position.display": { "binding": { "config": { "path": "view.custom.filters.active" }, "transforms": [ { "code": "\treturn len(value) \u003e 0", "type": "script" } ], "type": "property" } } }, "props": { "style": { "overflow": "visible" } }, "type": "ia.container.flex" }, { "meta": { "name": "ReulstLengthLabel" }, "position": { "grow": 1 }, "propConfig": { "position.display": { "binding": { "config": { "path": "view.custom.filters.active" }, "transforms": [ { "code": "\treturn len(value) \u003e 0", "type": "script" } ], "type": "property" } }, "props.text": { "binding": { "config": { "path": "../Table.props.data" }, "transforms": [ { "code": "\treturn \u0027\u0027.join([str(len(value)), \u0027 results within filters\u0027])", "type": "script" } ], "type": "property" } } }, "props": { "style": { "classes": "Menu/Item Page/Text", "fontSize": 12, "paddingLeft": 5, "textTransform": "lowercase" } }, "type": "ia.display.label" }, { "meta": { "name": "pager" }, "position": { "basis": "35px", "display": false, "shrink": 0 }, "propConfig": { "props.params.number_of_pages": { "binding": { "config": { "expression": "len({../Table.custom.raw_data})" }, "type": "expr" } }, "props.params.options_for_pagers": { "binding": { "config": { "path": "../Table.props.pager.options" }, "type": "property" } } }, "props": { "params": { "number_of_items_per_page": 100, "page_selected": 0 }, "path": "Components/PowerTable/pager" }, "type": "ia.display.view" }, { "events": { "component": { "onRowDoubleClick": { "config": { "script": "\t# grab row JSON from double-click\n\td \u003d event.value\n\t# build out query_params from row values\n\tquery_params \u003d {\n\t\t\"view\": d.destination_view,\n\t\t\"object_key\": d.destination_object_key,\n\t\t\"site\": d.destination_site,\n\t\t\"bucket\": d.destination_bucket\n\t}\n\t# Open version history log viewer\n\tview_path \u003d \u0027PopUp-Views/S3/Versions/Log_Viewer\u0027\n\tparams \u003d {\u0027query_params\u0027: query_params}\n\tsystem.perspective.openPopup(\u0027Version Log Viewer\u0027, view_path, \n\t\t\t\t\t\t\t\tparams, \u0027SCADA S3 Version History Log Viewer\u0027)\n\t" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Table" }, "position": { "grow": 1 }, "propConfig": { "custom.raw_data": { "binding": { "config": { "expression": "IF({../pager.props.params.number_of_items_per_page} \u003e 0,\r\nIF(LEN({view.custom.filters.active})\u003d0, {view.custom.table_data}, {view.custom.filtered_table_data}),\u0027\u0027)" }, "transforms": [ { "code": "\tlist_of_data \u003d []\n\tsingle_list \u003d []\n\tfor item in value:\n\t\tif len(single_list) \u003c self.getSibling(\"pager\").props.params.number_of_items_per_page:\n\t\t\tsingle_list.append(item)\n\t\telse:\n\t\t\tlist_of_data.append(single_list)\n\t\t\tsingle_list \u003d []\n\t\t\tsingle_list.append(item)\n\tif len(single_list) \u003e 0:\n\t\tlist_of_data.append(single_list)\n\treturn list_of_data", "type": "script" } ], "type": "expr" } }, "props.columns": { "binding": { "config": { "path": "view.custom.table_data" }, "transforms": [ { "code": "\tfrom helper.helper import sanitize_tree\n\tcolumns \u003d []\n\tif len(value) \u003e 0:\n\t\trequestedHeaders \u003d sanitize_tree(self.view.params.header_order)\n\t\tfrom pprint import pformat\n#\t\tsystem.perspective.print(pformat(requestedHeaders))\n\t\theaders \u003d []\n\t\tif len(requestedHeaders) \u003e 0:\n\t\t\tfor item in requestedHeaders:\n\t\t\t\tif \u0027style\u0027 in value[0].keys() and \u0027value\u0027 in value[0].keys() and len(value[0].keys()) \u003d\u003d2:\n\t\t\t\t\tif item in value[0][\u0027value\u0027].keys():\n\t\t\t\t\t\theaders.append(item)\n\t\t\t\telse:\n\t\t\t\t\tif item in value[0].keys():\n\t\t\t\t\t\theaders.append(item)\n\t\t\t\t\tif isinstance(item, dict) and \u0027field\u0027 in item and item[\u0027field\u0027] in value[0].keys():\n\t\t\t\t\t\theaders.append(item)\n\t\tif len(headers) \u003d\u003d 0:\n\t\t\theaders \u003d value[0].keys()\n\t\tfor header in headers:\t\n\t\t\tfield \u003d header\n\t\t\tvisible \u003d True\n\t\t\ttry:\n\t\t\t\ttitle \u003d str(header).replace(\u0027_\u0027, \u0027 \u0027).upper()\n\t\t\texcept:\n\t\t\t\ttitle \u003d \u0027\u0027\n\t\t\tif isinstance(header, dict):\n\t\t\t\tfield \u003d header.get(\u0027field\u0027, \u0027\u0027)\n\t\t\t\tvisible \u003d header.get(\u0027visible\u0027, True)\n\t\t\t\ttitle \u003d header.get(\u0027title\u0027, field.replace(\u0027_\u0027, \u0027 \u0027).upper())\n\t\t\tcolumn \u003d {\n\t\t\t \"field\": field,\n\t\t\t \"visible\": visible,\n\t\t\t \"editable\": True,\n\t\t\t \"render\": \"auto\",\n\t\t\t \"justify\": \"center\",\n\t\t\t \"align\": \"center\",\n\t\t\t \"resizable\": True,\n\t\t\t \"sortable\": True,\n\t\t\t \"sort\": \"none\",\n\t\t\t \"viewPath\": \"\",\n\t\t\t \"viewParams\": {},\n\t\t\t \"boolean\": \"checkbox\",\n\t\t\t \"number\": \"value\",\n\t\t\t \"progressBar\": {\n\t\t\t\t\"max\": 100,\n\t\t\t\t\"min\": 0,\n\t\t\t\t\"bar\": {\n\t\t\t\t \"color\": \"\",\n\t\t\t\t \"style\": {\n\t\t\t\t\t\"classes\": \"\"\n\t\t\t\t }\n\t\t\t\t},\n\t\t\t\t\"track\": {\n\t\t\t\t \"color\": \"\",\n\t\t\t\t \"style\": {\n\t\t\t\t\t\"classes\": \"\"\n\t\t\t\t }\n\t\t\t\t},\n\t\t\t\t\"value\": {\n\t\t\t\t \"enabled\": True,\n\t\t\t\t \"format\": \"0,0.##\",\n\t\t\t\t \"justify\": \"center\",\n\t\t\t\t \"style\": {\n\t\t\t\t\t\"classes\": \"\"\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t },\n\t\t\t \"toggleSwitch\": {\n\t\t\t\t\"color\": {\n\t\t\t\t \"selected\": \"\",\n\t\t\t\t \"unselected\": \"\"\n\t\t\t\t}\n\t\t\t },\n\t\t\t \"numberFormat\": \"0,0.##\",\n\t\t\t \"dateFormat\": \"MM/DD/YYYY\",\n\t\t\t \"width\": \"\",\n\t\t\t \"strictWidth\": False,\n\t\t\t \"style\": {\n\t\t\t\t\"classes\": \"\"\n\t\t\t },\n\t\t\t \"header\": {\n\t\t\t\t\"title\": title,\n\t\t\t\t\"justify\": \"center\",\n\t\t\t\t\"align\": \"center\",\n\t\t\t\t\"style\": {\n\t\t\t\t \"classes\": \"\",\n\t\t\t\t \u0027fontSize\u0027:\u002712px\u0027\n\t\t\t\t}\n\t\t\t },\n\t\t\t \"footer\": {\n\t\t\t\t\"title\": \"\",\n\t\t\t\t\"justify\": \"left\",\n\t\t\t\t\"align\": \"center\",\n\t\t\t\t\"style\": {\n\t\t\t\t \"classes\": \"\"\n\t\t\t\t}\n\t\t\t }\n\t\t\t}\t\t\t\n\t\t\tcolumns.append(column)\n#\t\tif self.view.params.header_order !\u003d [] and len(headers) \u003d\u003d len(self.view.params.header_order):\n#\t\t\tnew_columns \u003d [None] * len(columns)\n#\t\t\tfor column in columns:\n#\t\t\t\tindex \u003d self.view.params.header_order.index(column[\u0027field\u0027])\n#\t\t\t\tnew_columns[index] \u003d column\n#\t\t\tcolumns \u003d new_columns\n\treturn columns", "type": "script" } ], "type": "property" } }, "props.data": { "binding": { "config": { "expression": "IF({../pager.props.params.number_of_items_per_page} \u003e 0,\r\nIF(LEN({view.custom.filters.active})\u003d0, {view.custom.table_data}, {view.custom.filtered_table_data}),\u0027\u0027)" }, "type": "expr" } }, "props.filter.enabled": { "binding": { "config": { "path": "../TableHeader/TableActions/FilterCheck.props.selected" }, "type": "property" }, "onChange": { "enabled": null, "script": "\tif not getattr(currentValue, \u0027value\u0027, None):\n\t\t# clear filter text when filter is disabled\n\t\tself.props.filter.text \u003d \u0027\u0027\n\t\t" } } }, "props": { "cells": { "allowEditOn": "long-press", "style": { "fontSize": 12 } }, "filter": {}, "pager": { "initialOption": 100, "options": [ 25, 50, 100, 500, 1000 ] }, "style": { "overflow": "visible" } }, "type": "ia.display.table" } ], "meta": { "name": "root" }, "props": { "direction": "column", "style": { "overflow": "visible" } }, "scripts": { "customMethods": [], "extensionFunctions": null, "messageHandlers": [ { "messageType": "activate-filter", "pageScope": true, "script": "\t# implement your handler here\n\tfilter_position \u003d payload[\u0027id\u0027]\n\tsystem.perspective.print(filter_position)\n\tadd \u003d True\n\tfor filter in self.view.custom.filters.active:\n\t\tif filter.id \u003d\u003d filter_position:\n\t\t\tadd \u003d False\n\tif add:\n\t\tfor filter in self.view.custom.filters.deactive:\n\t\t\tif filter.id \u003d\u003d filter_position:\t\t\t\t\n\t\t\t\tself.view.custom.filters.active.append(filter)", "sessionScope": true, "viewScope": false }, { "messageType": "deactivate-filter", "pageScope": true, "script": "\tfilter_position \u003d payload[\u0027id\u0027]\n\tsystem.perspective.print(filter_position)\n\t\n\tif filter_position \u003d\u003d -1 :\n\t\tself.view.custom.filters.active \u003d []\n\telse:\n\t\tfor index, filter in enumerate(self.view.custom.filters.active):\n\t\t\tif filter.id \u003d\u003d filter_position:\n\t\t\t\tsystem.perspective.print(filter.id)\n\t\t\t\tself.view.custom.filters.active.pop(index)\n\n#\tfor filter in self.view.custom.filter_menu_data:\n#\t\tif filter.filter_id \u003d\u003d filter_position:\n#\t\t\tsystem.perspective.print(filter.filter_id)\n#\t\t\tfilter.active \u003d False\n#\t\t\tbreak", "sessionScope": false, "viewScope": false }, { "messageType": "column-visibility", "pageScope": true, "script": "\t# implement your handler here\n\ttable_columns \u003d self.getChild(\"Table\").props.columns\n\tfor table_column in table_columns:\n\t\t#if payload.keys()[0] \u003d\u003d table_column[\u0027field\u0027]:\n\t\tif payload.keys()[0] \u003d\u003d table_column[\u0027header\u0027][\u0027title\u0027]:\n\t\t\ttable_column.visible \u003d payload.values()[0]\n", "sessionScope": false, "viewScope": false } ] }, "type": "ia.container.flex" } }