var init = function() { var data = Vmap.Model.StandardView.data, deletedSecurityData = Vmap.Model.StandardView.deletedSecurityData, loaderConfig = Object.create(Vmap.Ignite.Settings.Loader.getStandardConfiguration(), {}), securityOnlyModel = jQuery("#securityOnlyModel"); loaderConfig.resources = "igGrid, igGrid.Updating, igGrid.Summaries, igGrid.GroupBy"; loaderConfig.ready = function() { securityOnlyModel.igGrid({ dataSource: data, dataSourceType: "json", primaryKey: "security", autoGenerateColumns: false, autoGenerateLayouts: false, virtualization: false, columns: _getTableColumns(), renderCheckboxes: true, rendered: function() { jQuery("tr").addClass("readOnly"); }, features: [ { name: "Updating", validation: false, enableAddRow: false, editMode: "cell", excelNavigationMode: true, enableDeleteRow: false, showDoneCancelButtons: false, editRowEnding: function(evt, ui) { //if(ui.values) { // if(ui.values["security"] != "" && ui.values["securityCusip"] != "") { // jQuery("tr[data-id='" + ui.rowID + "']").addClass("readOnly"); // } // } }, editRowStarting: function(evt, ui) { if(jQuery("tr.readOnly[data-id='" + ui.rowID + "']").length == 1) { return false; } }, columnSettings: [ //{columnKey: "delete", readOnly: true}, // {columnKey: "security", readOnly: true}, // {columnKey: "securityCusip", readOnly: true}, // {columnKey: "securityDescription", readOnly: true}, // {columnKey: "securityPrice", readOnly: true}, // {columnKey: "securityDelta", readOnly: true} ] }, { name: "Summaries", showDropDownButton: false, columnSettings: [ {columnKey: "delete", allowSummaries: false}, {columnKey: "security", allowSummaries: true, summaryOperands: [{"rowDisplayLabel": "Total Securities", "type": "COUNT", "active": true}]}, {columnKey: "securityCusip", allowSummaries: false}, {columnKey: "securityDescription", allowSummaries: false}, {columnKey: "securityPrice", allowSummaries: false}, {columnKey: "securityDoNotBuy", allowSummaries: false}, {columnKey: "securityDoNotSell", allowSummaries: false}, {columnKey: "securityWeight", allowSummaries: true, summaryOperands: [{"rowDisplayLabel": "Total Weight", "type": "SUM", "active": true}]}, {columnKey: "securityQuantity", allowSummaries: false}, {columnKey: "securityMinWeight", allowSummaries: false}, {columnKey: "securityMaxWeight", allowSummaries: false}, {columnKey: "securityDelta", allowSummaries: false} ] }, { name: "GroupBy", groupByAreaVisibility: "hidden", columnSettings: [ {columnKey: "delete", allowGrouping: false}, {columnKey: "security", allowGrouping: false}, {columnKey: "securityCusip", allowGrouping: false}, {columnKey: "securityDescription", allowGrouping: false}, {columnKey: "securityPrice", allowGrouping: false}, {columnKey: "securityDoNotBuy", allowGrouping: false}, {columnKey: "securityDoNotSell", allowGrouping: false}, {columnKey: "securityWeight", allowGrouping: false}, {columnKey: "securityQuantity", allowGrouping: false}, {columnKey: "securityMinWeight", allowGrouping: false}, {columnKey: "securityMaxWeight", allowGrouping: false}, {columnKey: "securityDelta", allowGrouping: false}, {columnKey: "securityId", allowGrouping: false}, {columnKey: "modelTargetStatus", allowGrouping: false}, {columnKey: "authorizationState", allowGrouping: false}, {columnKey: "disableInHistory", allowGrouping: false}, {columnKey: "hasLinkedAccount", allowGrouping: false}, {columnKey: "modelIsReadOnly", allowGrouping: false}, {columnKey: "modelLookupIdJSON", allowGrouping: false}, {columnKey: "encodedSecurityCusip", allowGrouping: false}, {columnKey: "encodedSecurityName", allowGrouping: false} ] } ] }); jQuery("#groupBy").click(function() { securityOnlyModel.igGridGroupBy("openGroupByDialog"); }); jQuery("#deletedSecurityModelTable").igGrid({ dataSource: deletedSecurityData, columns: _getTableColumns(), autoGenerateColumns: false, renderCheckboxes: true }); }; jQuery.ig.loader(loaderConfig); }; ////////////////////////////////////////////////////////////////////////////////// var _getTableColumns = function() { var templates = { securityRemoveTemplate: jQuery("#securityRemoveTemplate").html(), securityTemplate: jQuery("#securityTemplate").html(), securityCusipTemplate: jQuery("#securityCusipTemplate").html() }, securityOnlyModel = Vmap.Model.StandardView; return [ {headerText: "Delete", key: "delete", hidden: securityOnlyModel.printableView, template: templates.securityRemoveTemplate}, {headerText: "Security", key: "security", template: templates.securityTemplate}, {headerText: "Cusip", key: "securityCusip", template: templates.securityCusipTemplate}, {headerText: "Description", key: "securityDescription"}, {headerText: "Price", key: "securityPrice", columnCssClass: "numberRightAlign"}, {headerText: "Do Not Buy", key: "securityDoNotBuy", dataType: "bool"}, {headerText: "Do Not Sell", key: "securityDoNotSell", dataType: "bool"}, {headerText: "Weight", key: "securityWeight", dataType: "number", format: "0.000", columnCssClass: "numberRightAlign"}, {headerText: "Quantity", key: "securityQuantity", dataType: "number", format: "0.0000", columnCssClass: "numberRightAlign", hidden: !(securityOnlyModel.quantityBased && !securityOnlyModel.editWeights)}, {headerText: "Min Weight", key: "securityMinWeight", columnCssClass: "numberRightAlign", hidden: !(securityOnlyModel.usePositionLevelDriftTolerances && (!securityOnlyModel.quantityBased && securityOnlyModel.editWeights))}, {headerText: "Max Weight", key: "securityMaxWeight", columnCssClass: "numberRightAlign", hidden: !(securityOnlyModel.usePositionLevelDriftTolerances && (!securityOnlyModel.quantityBased && securityOnlyModel.editWeights))}, {headerText: "Delta", key: "securityDelta", columnCssClass: "numberRightAlign"}, // These are here to provide data for the templates. {headerText: "securityId", key: "securityId", hidden: "true"}, {headerText: "modelTargetStatus", key: "modelTargetStatus", hidden: "true"}, {headerText: "authorizationState", key: "authorizationState", hidden: "true"}, {headerText: "disableInHistory", key: "disableInHistory", hidden: "true"}, {headerText: "hasLinkedAccount", key: "hasLinkedAccount", hidden: "true"}, {headerText: "modelIsReadOnly", key: "modelIsReadOnly", hidden: "true"}, {headerText: "modelLookupIdJSON", key: "modelLookupIdJSON", hidden: "true"}, {headerText: "encodedSecurityCusip", key: "encodedSecurityCusip", hidden: "true"}, {headerText: "encodedSecurityName", key: "encodedSecurityName", hidden: "true"}, {headerText: "Asset Category", key: "securityAssetCategory", hidden: "true"}, {headerText: "Asset Class", key: "securityAssetClass", hidden: "true"}, {headerText: "Security Type", key: "securityType", hidden: "true"}, {headerText: "Security Type Class", key: "securityTypeClass", hidden: "true"}, {headerText: "Investment Type", key: "securityInvestmentType", hidden: "true"}, {headerText: "Sector", key: "securitySector", hidden: "true"}, {headerText: "Industry", key: "securityIndustry", hidden: "true"} ]; };