Creating Custom Tables
See http://www.datatables.net for more information. The generated table will have some standard styling and options applied.
// Table data. 2 rows, 5 columns var tableData = [ [1, 16, 2, 24, 64], [2, 17, 5, 96, 22] ];
<table id="actions-table"></table>
var table1 = new insight.components.Table({ id: 'actions-table', columns: [ {name: 'Index', type: insight.enums.DataType.INTEGER, width: '40px'}, {name: 'Column 1', type: insight.enums.DataType.REAL, width: '60px'}, {name: 'Column 2', type: insight.enums.DataType.REAL, width: '60px'}, {name: 'Column 3', type: insight.enums.DataType.STRING, width: '60px'}, {name: 'Column 4', type: insight.enums.DataType.STRING, width: '60px'} ], data: tableData });
The columns property is an array of column configuration objects. Each configuration object needs to contain a name property and can contain any of the optional properties. For a full list of required and optional properties, see the JavaScript API reference for insight.components.Table.
By default no data formatting will be applied to columns. However if you specify the type property in the column configuration with which you instantiate the Table component, then you can benefit from any global formatting rules that apply. There are system default number formats that can be modified globally and will be applied to integers and reals. You can also specify the render configuration property for custom rendering and formatting of cells.
The Table component can be made editable per column. When configuring editable columns, you will need to provide a callback function that will be invoked on each edit finishing. This callback will be passed the new value of the cell, an array of row data, and the actual cell object. Within the callback, you can perform validation of the new value (or use the editorValidate configuration property as described in the JavaScript documentation) and take any action needed upon success. When validation fails or if there is a problem processing the value, you should throw an error with a meaningful message for the end user.
var table = new insight.components.Table({ id: 'data-table', columns: [ { name: 'Boolean', type: insight.enums.DataType.INTEGER, editable: true, editorType: 'checkbox', uncheckedValue: 0, checkedValue: 1 }, { name: 'Integer (1-10000)', type: insight.enums.DataType.INTEGER, editable: true, editorSave: function (newValue, rowData, cellElement) { // Should only accept integers between 1-10000 if (!isNaN(newValue) && (newValue % 1 === 0) && newValue >= 1 && newValue <= 10000) { alert('Perform some action on new value: ' + newValue); return; } // Throw Errors if anything goes wrong throw new Error('New value is invalid, will not save: ' + newValue); } } ], data: data );
© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.