when i upgraded to this version SmartClient Ajax RIA system Version v12.0p_2019-02-12/PowerEdition Deployment (2019-02-12)
the following started happening when editing ListGrid with a custom type
here is a test case :
the following started happening when editing ListGrid with a custom type
here is a test case :
Code:
<html> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <SCRIPT>window.isc_useSimpleNames = false; var isomorphicDir='../isomorphic/';</SCRIPT> <SCRIPT SRC="../isomorphic/system/modules/ISC_Core.js"> </script><SCRIPT SRC="../isomorphic/system/modules/ISC_Foundation.js"> </script><SCRIPT SRC="../isomorphic/system/modules/ISC_Containers.js"> </script><SCRIPT SRC="../isomorphic/system/modules/ISC_Grids.js"></script> <SCRIPT SRC="../isomorphic/system/modules/ISC_Forms.js"></script> <SCRIPT SRC="../isomorphic/skins/Enterprise/load_skin.js"></script> <SCRIPT SRC="../isomorphic/system/modules/ISC_DataBinding.js"></script> </head> <body> <script> isc.ClassFactory.defineClass("GridEditorItem", "CanvasItem"); isc.SimpleType.create({ name: "msfUOM", inheritsFrom: "float", normalDisplayFormatter: function (value) { var v = isc.NumberUtil.format(value/0.092903/1000.0,",0.00"); return v; }, shortDisplayFormatter: function (value) { return this.normalDisplayFormatter(value); } }); countryData = [ { continent:"North America", countryName:"United States", countryCode:"US", area:0, areaM:0, population:298444215, gdp:12360.0, independence:new Date(1776,6,4), government:"federal republic", government_desc:2, capital:"Washington, DC", member_g8:true, article:"http://en.wikipedia.org/wiki/United_states" }, { continent:"Asia", countryName:"China", countryCode:"CH", area:0, areaM:0, population:1313973713, gdp:8859.0, government:"Communist state", government_desc:0, capital:"Beijing", member_g8:false, article:"http://en.wikipedia.org/wiki/China" }, { continent:"Asia", countryName:"Japan", countryCode:"JA", area:0, areaM:0, population:127463611, gdp:4018.0, government:"constitutional monarchy with parliamentary government", government_desc:1, capital:"Tokyo", member_g8:true, article:"http://en.wikipedia.org/wiki/Japan" }, { continent:"Asia", countryName:"South Korea", countryCode:"KS", area:0, areaM:0, population:48846823, gdp:965.3, independence:new Date(1945,7,15), government:"republic", government_desc:5, capital:"Seoul", member_g8:false, article:"http://en.wikipedia.org/wiki/South_korea" }, { continent:"Asia", countryName:"Indonesia", countryCode:"ID", area:0, areaM:0, population:245452739, gdp:865.6, independence:new Date(1945,7,17), government:"republic", government_desc:5, capital:"Jakarta", member_g8:false, article:"http://en.wikipedia.org/wiki/Indonesia" } ]; isc.RestDataSource.create({ ID: 'countryDS', clientOnly: true, testData: countryData, fields:[ { name: "continent"}, { name: "countryName"}, { name: "area", title: ('area'), type: 'msfUOM', required: true, allowEmptyValue:false}, { name: "areaM", title: ('areaM'), type: 'msfUOM', required: false, allowEmptyValue:false}, { name: "population", title: ('population'), type: 'float',format:',0',required: true }, { name: 'gdp', title: ('gdp')}, { name: "government",title: ('government')}, { name: "independence",title: ('independence'),type:"date", useTextField:true,required: true}, { name: 'capital', title: ('capital'), type: 'integer' }, { name: 'member_g8', title: ('member_g8'), type: 'boolean'}, { name: "article",title: ('article')} ] }); isc.GridEditorItem.addProperties({ height:"*", width:"*", rowSpan:"*", colSpan:"*", endRow:true, startRow:true, // this is going to be an editable data item shouldSaveValue:true, // Override createCanvas to create the ListGrid with the user can use to set the value. createCanvas : function () { var gridDS = isc.DS.get(this.gridDataSource); return isc.ListGrid.create({ autoDraw:false, // fill the space the form allocates to the item leaveScrollbarGaps:false, // dataSource and fields to use, provided to a listGridItem as // listGridItem.gridDataSource and optional gridFields dataSource:gridDS, fields:this.gridFields, sortField:this.gridSortField, groupByField:this.gridGroupByField, sortDirection: this.gridSortDirection, saveByCell:this.gridSaveByCell, editByCell:this.gridEditByCell, // the record being edited is assumed to have a set of subrecords data:this.getValue(), canEdit:this.gridCanEdit, editEvent:this.gridEditEvent, saveLocally:true, showGridSummary: true, showGroupSummary: true, showGroupSummaryInHeader: true, saveLocally: true, // prevents updates to the datasource autoFetchData:false, canMultiGroup: true, showRecordComponents: true, showRecordComponentsByCell: true, groupStartOpen:"all", autoFitWidthApproach:"both", // update form when data changes cellChanged : function () { this.canvasItem.saveValue(this.data); if (this.canvasItem.gridSortField != null) { this.sort(this.canvasItem.gridSortField,this.canvasItem.gridSortDirection); } }, //recordDoubleClick: "addItemForm.setData(record);addItemWindow.show();", emptyMessage: "<br>"+"nothingSelected"+"</b>", createRecordComponent : this.gridRecordComponent, cellContextClick: this.gridCellContextClick, // allow Hovers canHover: true, showHover: true, // allow hoverComponents showHoverComponents: true, // override the builtin getCellHoverComponent() method so we can return a component of our // choosing - in this case, create a DetailViewer, populate it with the entire record from // the server and return it for display getCellHoverComponent : function (record, rowNum, colNum) { this.rowHoverComponent = isc.DetailViewer.create({ dataSource: gridDS, width: 250 }); this.rowHoverComponent.setData(record); return this.rowHoverComponent; } }); }, // implement showValue to update the ListGrid data // Note that in this case we care about the underlying data value - an array of records showValue : function (displayValue, dataValue) { if (this.canvas == null) return; this.canvas.setData(dataValue); } }); isc.DynamicForm.create({ ID: "testForm", width:900, height:500, fields: [ { name: "items", colSpan:6, align:"center", width:"*", height:"*", showTitle:false, gridCanEdit:true, gridEditEvent: "click", editorType:"GridEditorItem", gridDataSource:"countryDS", gridSaveByCell:true, gridEditByCell:true, gridFields:[ { name: "countryName", canEdit:false,showGridSummary:false, showGroupSummary: false}, { name: "area",cellChanged: function(record, newValue, oldValue, rowNum, colNum, grid){ if ( newValue > 0) record.areaM = newValue / 25.4; else record.areaM = 0; }}, { name: "areaM"}, { name: 'removeItemBtn', title:" ",width:25} ], saveLocally: true, // prevents updates to the datasource autoFetchData:false, startRow:false , endRow:false, //gridCellContextClick:"return widthMenu.showContextMenu()", gridRecordComponent:function (record, colNum) { var fieldName = this.getFieldName(colNum); if (fieldName == "removeItemBtn") { var button = isc.IButton.create({ height: 18, width: 25, icon: "general_delete.png", title: "", click : function () { rollstockRequestForm.getItem("items").canvas.removeData(record); } }); return button; } else { return null; } } } ] }); testForm.getItem("items").canvas.setData(countryData); </script> </body> </html>
Comment