Hi there,
The following ListGrid is causing problems when calling getFieldState in the process of calling getViewState(). So, I had to patch in an extra null check as follows below on the variable _2. Let me know if this fix will make it into 7.0. If not, I'll extend my patch. Thanks.
ListGrid definition:
Patch
The following ListGrid is causing problems when calling getFieldState in the process of calling getViewState(). So, I had to patch in an extra null check as follows below on the variable _2. Let me know if this fix will make it into 7.0. If not, I'll extend my patch. Thanks.
ListGrid definition:
Code:
isc.ATListGrid.create({ ID:"fundAssetSectorGrid", height:250, cellHoverHTML:function (record, rowNum, colNum){ var returnText=""; var cellHoverHTML = this.Super("cellHoverHTML",arguments); if(cellHoverHTML!=null){ returnText += cellHoverHTML; } //make this editable now with pctAllocation so this text no longer applies //returnText += addFASGridHoverText(record, colNum); return returnText; }, canEdit:true, editEvent:"doubleClick", canEditCell : function (rowNum, colNum) { var record = this.getRecord(rowNum); var fieldName = this.getFieldName(colNum); //allow editing fundSectorID on an Add if(record==null && fieldName=="fundSectorID"){ return true; } if (record!=null && record.analystGroup ) { return false; } return this.Super("canEditCell", arguments); }, recordDoubleClick: function (viewer, record, recordNum, field, fieldNum, value, rawValue) { if(record!=null){ if(record.analystGroup && !this.canEditCell(recordNum,fieldNum)){ isc.warn(PROMPT_CANTEDIT_SECTOR); } } }, canSort:true, autoSaveEdits:false, cellContextClick:function(record,rowNum,colNum){ this.currentRowNum = rowNum; return this.Super("cellContextClick",arguments); }, listEndEditAction:"next", contextMenu: fundAssetSectorMenu, emptyMessage:"<spring:message code="label.emptygrid"/>", editPendingBaseStyle: 'editedCell', editorEnter : function (record, value, rowNum, colNum) { if(detailFundAssetRecord==null){ //if a detail record is not selected, something //went wrong, deselect and start over deselectFundAssetsGrid(); return; } this.currentEditRowNum = rowNum; if(record==null){ this.deselectAllRecords(); } var editValues = this.getEditValues(rowNum); if (editValues.fundAssetID == null && detailFundAssetRecord!=null){ this.setEditValue(rowNum, "fundAssetID", detailFundAssetRecord.fundAssetID); } if (record==null && editValues.fundSectorID == null) this.setEditValue(rowNum, "fundSectorID", null); }, fields:[ {name:"fundSectorID", editorType:"selectItem", width:125, canEdit:false, align:"left",editorValueMap:fundSectorEditorValueMap,valueMap:fundSectorValueMap, prompt:"<spring:message code="desc.fas.sector"/>"}, {name:"pctAllocation", defaultValue:100,canEdit:true,canFilter:false,width:"10%", align:"right", prompt:"<spring:message code="desc.fas.pctallocation"/>" }, {name:"maxGrossExposure", canEdit:false,width:125, prompt:"<spring:message code="desc.fas.maxgrossexposure"/>"}, {name:"maxNetExposure",canEdit:false, width:125, prompt:"<spring:message code="desc.fas.maxnetexposure"/>"}, {name:"optimalGrossExposure", canEdit:false, prompt:"<spring:message code="desc.sector.optimalgrossexposure"/>"}, {name:"currentGrossExposure", canEdit:false, prompt:"<spring:message code="desc.sector.currentgrossexposure"/>"}, {name:"optimalNetExposure", canEdit:false, prompt:"<spring:message code="desc.sector.optimalnetexposure"/>"}, {name:"currentNetExposure", canEdit:false, prompt:"<spring:message code="desc.sector.currentnetexposure"/>"}, <%-- We don't show these by default --%> {name:"optimalBetaAdjNetExposure", canEdit:false, prompt:"<spring:message code="desc.sector.optimalbetanetexposure"/>",showIf:"return false;"}, {name:"optimalBetaAdjGrossExposure", canEdit:false, prompt:"<spring:message code="desc.sector.optimalbetagrossexposure"/>",showIf:"return false;"}, {name:"optimalDeltaAdjNetExposure", canEdit:false, prompt:"<spring:message code="desc.sector.optimaldeltanetexposure"/>",showIf:"return false;"}, {name:"optimalDeltaAdjGrossExposure", canEdit:false, prompt:"<spring:message code="desc.sector.optimaldeltagrossexposure"/>",showIf:"return false;"}, {name:"currentBetaAdjNetExposure", canEdit:false, prompt:"<spring:message code="desc.sector.currentbetanetexposure"/>",showIf:"return true;"}, {name:"currentBetaAdjGrossExposure", canEdit:false, prompt:"<spring:message code="desc.sector.currentbetagrossexposure"/>",showIf:"return true;"}, {name:"currentDeltaAdjNetExposure", canEdit:false, prompt:"<spring:message code="desc.sector.currentdeltanetexposure"/>",showIf:"return true;"}, {name:"currentDeltaAdjGrossExposure", canEdit:false, prompt:"<spring:message code="desc.sector.currentdeltagrossexposure"/>",showIf:"return true;"}, {name:"created", canEdit:false,width:75,canFilter:false, showIf:"return false;", prompt:"<spring:message code="desc.created"/>"}, {name:"createdUserName", canEdit:false,width:75,canFilter:false, showIf:"return false;", prompt:"<spring:message code="desc.createdby"/>"}, {name:"modified", showIf:"return false;",canEdit:false,width:75,canFilter:false, prompt:"<spring:message code="desc.modified"/>"}, {name:"modifiedUserName", canEdit:false,width:75,canFilter:false, showIf:"return false;", prompt:"<spring:message code="desc.modifiedby"/>"} ], dataSource:FundAssetSector })
Patch
Code:
if (window.isc && isc.version.startsWith("6.5.1/")) { isc.ListGrid.addProperties({ getFieldState:function(){ var _1=[]; if(this.completeFields){ var _2=null; if(this.header!=null && this.header.members!=null){ _2=this.header.members; } for(var i=0;i<this.completeFields.length;i++){ var _4=this.completeFields[i],_5=_4[this.fieldIdProperty],_6={name:_5}; if(!this.fieldIsVisible(_4))_6.visible=false; if(_2!=null){ var _7=_2.find(this.fieldIdProperty,_5); if(_7&&_7.$pn&&isc.isA.Number(_7.$pn)){ _6.width=_7.$pn; } } _1.add(_6); } } return isc.Comm.serialize(_1); } }); }
Comment