I got different appearance in IE/FireFox for a custom grid. See attached image file. What can we do for adjustion ?
Code:
public void descSalesForecastValueGrid(Criteria criteria,final UsccForecastWorksheet myUsccForecastWorksheet) { try{ final Record myApContextSeriesValue ; // final RecordList recordList = new RecordList(); final Menu cellContextMenu; final List<ListGridField> calculateFieldList = new ArrayList<ListGridField>(); final List<HeaderSpan> headerSpanList = new ArrayList<HeaderSpan>(); final String groupByField = "schemeSectionName"; final int columnsWidth = 80; final int cellHeight = 30; final int headerHeight = 50; //--------------------------------- final DataSource calculateDS = DataSource.get(SalesforecastConstant.DMINAME_SERIESVALUEDMI); //提取原始數據 calculateDS.fetchData(criteria, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { Record[] itemList = Record.convertToRecordArray((JavaScriptObject)rawData); if (itemList.length == 0) { return ; } //Grid Span int headerSpanIndex = itemList.length - 1; Record headerSpanRecord = itemList[headerSpanIndex]; final String[] headerSpans = headerSpanRecord.getAttributes(); final Map<String,HashMap> spanExpanded = new HashMap<String,HashMap>(); if (headerSpans.length > 0) { for(int i=0;i<headerSpans.length;i++) { String SpanKey = headerSpans[i]; String[] SpanConName = headerSpanRecord.getAttributeAsStringArray(SpanKey); HeaderSpan headerSpan = new HeaderSpan(SpanKey,SpanConName); headerSpanList.add(headerSpan); //初始化展开Span HashMap spanConProperty = new HashMap(); spanConProperty.put("isShow", true); spanConProperty.put("spanContent", SpanConName); spanExpanded.put(SpanKey, spanConProperty); } } //Grid Header int headerFieledIndex = itemList.length - 2; Record headerFieledRecord = itemList[headerFieledIndex]; final String[] headerFileds = headerFieledRecord.getAttributes(); if (headerFileds.length > 0) { for (int i=0;i<headerFileds.length;i++) { String columnsKey = headerFileds[i]; String columnsName = headerFieledRecord.getAttribute(columnsKey); //定義ValueGrid中的列 ListGridField lgf_displayText = new ListGridField(columnsKey,columnsName); lgf_displayText.setCanSort(false); //定義ValueGrid中的列 if (columnsKey.equalsIgnoreCase("schemeSectionKey")) { lgf_displayText.setHidden(true); } else if (columnsKey.equalsIgnoreCase("schemeSectionName")) { lgf_displayText.setWidth(170); lgf_displayText.setAlign(Alignment.CENTER); lgf_displayText.setCellAlign(Alignment.LEFT); lgf_displayText.setFrozen(true); } else if (columnsKey.equalsIgnoreCase("modelSeriesRoleID")) { //定義ValueGrid中的列 lgf_displayText.setHidden(true); } else if (columnsKey.equalsIgnoreCase("modelSeriesRoleName")) { //定義ValueGrid中的列 lgf_displayText.setWidth(130); lgf_displayText.setAlign(Alignment.CENTER); lgf_displayText.setCellAlign(Alignment.LEFT); lgf_displayText.setFrozen(true); } else if (columnsKey.equalsIgnoreCase("unitName")) { //定義ValueGrid中的列 lgf_displayText.setWidth(columnsWidth/2); lgf_displayText.setAlign(Alignment.CENTER); lgf_displayText.setFrozen(true); } else if (columnsKey.equalsIgnoreCase("hasEvent")) { lgf_displayText.setHidden(true); } else if (columnsKey.equalsIgnoreCase("seriesEditable")) { lgf_displayText.setHidden(true); } else{ //定義ValueGrid中的數值列 lgf_displayText.setWidth(columnsWidth); lgf_displayText.setAlign(Alignment.CENTER); lgf_displayText.setType(ListGridFieldType.INTEGER); // IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator(); // integerRangeValidator.setMin(1); // lgf_displayText.setValidators(integerRangeValidator); } calculateFieldList.add(lgf_displayText); } } //數據 RecordList dataRecordList = new RecordList(); for (int i=0;i<headerFieledIndex;i++) { dataRecordList.add(itemList[i]); } //创建valueGrid final ObjectListGrid valueGrid = new ObjectListGrid() { @Override protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) { String fieldName = this.getFieldName(colNum); HLayout recordCanvas = new HLayout(); // recordCanvas.setBorder("1px solid black"); recordCanvas.setWidth100(); recordCanvas.setHeight(cellHeight); recordCanvas.setAlign(Alignment.RIGHT); if (fieldName.equals("schemeSectionName")) { final String labelValue = record.getAttribute("schemeSectionName"); final boolean hasEvent = record.getAttributeAsBoolean("hasEvent"); if (hasEvent) { ImgButton eventImg = new ImgButton(); eventImg.setShowDown(false); eventImg.setShowRollOver(false); // eventImg.setLayoutAlign(Alignment.RIGHT); eventImg.setLayoutAlign(VerticalAlignment.CENTER); eventImg.setSrc("icon_calendar.png"); eventImg.setHeight(16); eventImg.setWidth(16); // eventImg.setBorder("1px solid black"); eventImg.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window window = calendarEventBlock.getCalendarEventWindow(); window.show(); } }); recordCanvas.addMember(eventImg); return recordCanvas; }else { return null; } } else if (fieldName.equals("modelSeriesRoleName")) { final String labelValue = record.getAttribute("modelSeriesRoleName"); final boolean seriesEditable = record.getAttributeAsBoolean("seriesEditable"); if (seriesEditable) { ImgButton editaleImg = new ImgButton(); editaleImg.setShowDown(false); editaleImg.setShowRollOver(false); // editaleImg.setLayoutAlign(Alignment.RIGHT); editaleImg.setLayoutAlign(VerticalAlignment.CENTER); editaleImg.setSrc("icon_totalQtyAdj.png"); editaleImg.setHeight(16); editaleImg.setWidth(16); // editaleImg.setBorder("1px solid black"); editaleImg.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window window = totalAdjustRuleBlock.getTotalAdjustRuleWindow(); window.show(); } }); recordCanvas.addMember(editaleImg); return recordCanvas; }else { return null; } } else { return null; } } }; valueGrid.setWidth100(); valueGrid.setHeight("300"); valueGrid.setCellHeight(cellHeight); valueGrid.setHeaderHeight(headerHeight); //編輯有關的屬性 valueGrid.setCanEdit(true); valueGrid.setEditByCell(false); valueGrid.setAlwaysShowEditors(true); valueGrid.setEditEvent(ListGridEditEvent.CLICK); // valueGrid.setModalEditing(true); valueGrid.setShowHeaderContextMenu(false); valueGrid.setShowHeaderMenuButton(false); valueGrid.setShowAllRecords(true); valueGrid.setCanResizeFields(true); valueGrid.setAutoFetchData(false); //保存有关属性 // valueGrid.setSaveByCell(true); valueGrid.setAutoSaveEdits(false); valueGrid.setShowRecordComponents(true); valueGrid.setShowRecordComponentsByCell(true); //設置Grid Header valueGrid.setFields(calculateFieldList.toArray(new ListGridField[0])); valueGrid.setHeaderSpans(headerSpanList.toArray(new HeaderSpan[0])); //設置Grid Group // valueGrid.setGroupByField(groupByField); //設置Grid Data valueGrid.setData(dataRecordList);
Comment