Hello,
I am using SmartClient Version: v8.3p_2013-02-26/Enterprise Deployment (built 2013-02-26) and have a problem on exporting client data from Listgrid.
Another question regarding background color. Is there anyway to exporting ListGrid data with background color of each cell? you may refer to attached screen shot.
Please refer to code below for initiating ListGrid.
And refer to code below for exporting client data.
When I saved data of ListGrid, It is saved well but Headerspan titles aren't aligned well with header. As you can see in the attached file, from headerspan (%), it isn't aligned with headers.
Please, let me know how I can aligned it.
Thanks.
I am using SmartClient Version: v8.3p_2013-02-26/Enterprise Deployment (built 2013-02-26) and have a problem on exporting client data from Listgrid.
Another question regarding background color. Is there anyway to exporting ListGrid data with background color of each cell? you may refer to attached screen shot.
Please refer to code below for initiating ListGrid.
Code:
ListGrid listGrid = new ListGrid() { @Override protected String getBaseStyle(ListGridRecord record, int rowNum, int colNum) { String platform = record.getAttributeAsString("platform"); if (colNum == 7 && platform.indexOf("TOTAL") == -1 && !platform.equals("Owned CIMitar") && !platform.equals("Consigned CIMitar")) { return "myBoxedGridCellGreen"; } else if (platform.endsWith("TOTAL") && !platform.equals("OVERALL TOTAL")) { return "myBoxedGridCellYellow"; } else if (platform.equals("Owned CIMitar") || platform.equals("Consigned CIMitar") || platform.equals("OVERALL TOTAL")) { return "myBoxedGridCellGray"; } else if (colNum >= 10) { if (colNum < 15) { if ((colNum == 10 && record.getAttributeAsDouble("exDown") > 3.0D) || (colNum == 11 && record.getAttributeAsDouble("diffFt") > 3.0D) || (colNum == 12 && record.getAttributeAsDouble("diffRe") > 3.0D) || (colNum == 13 && record.getAttributeAsDouble("diffQa") > 3.0D) || (colNum == 14 && record.getAttributeAsDouble("handling") > 3.0D)) { return "myBoxedGridCellLimit"; } } else if (colNum >= 15) { if ((colNum == 15 && record.getAttributeAsDouble("retest") > 5.0D) || (colNum == 16 && record.getAttributeAsDouble("qa") > 5.0D) || (colNum == 17 && record.getAttributeAsDouble("handler") > 5.0D) || (colNum == 18 && record.getAttributeAsDouble("material") > 5.0D) || (colNum == 19 && record.getAttributeAsDouble("engr") > 5.0D) || (colNum == 20 && record.getAttributeAsDouble("setup") > 5.0D) || (colNum == 21 && record.getAttributeAsDouble("tester") > 5.0D) || (colNum == 22 && record.getAttributeAsDouble("noSchd") > 5.0D) || (colNum == 23 && record.getAttributeAsDouble("pmCal") > 5.0D) || (colNum == 24 && record.getAttributeAsDouble("noWork") > 5.0D) || (colNum == 25 && record.getAttributeAsDouble("hdTem") > 5.0D) || (colNum == 26 && record.getAttributeAsDouble("other") > 5.0D) || (colNum == 27 && record.getAttributeAsDouble("excludeMatlEX") > 5.0D)) { return "myBoxedGridCellLimit"; } } } return super.getBaseStyle(record, rowNum, colNum); } }; listGrid.setAutoFitData(Autofit.HORIZONTAL); listGrid.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH); listGrid.setCanAutoFitFields(false); listGrid.setCanSort(false); listGrid.setCanGroupBy(false); listGrid.setCanPickFields(false); listGrid.setAutoFitFieldWidths(true); listGrid.setCanSort(false); listGrid.setCanFreezeFields(false); listGrid.setBaseStyle("myBoxedGridCell"); listGrid.setCellHeight(15); listGrid.setOverflow(Overflow.AUTO); listGrid.setShowEmptyMessage(true); listGrid.setEmptyMessage("No items to show"); listGrid.setWidth100(); listGrid.setHeaderHeight(55); listGrid.setHeaderSpanHeight(20); listGrid.setHeight(500); ListGridField platformField = new ListGridField("platform", "Platform"); ListGridField totalCountField = new ListGridField("totalCount", "T-CNT"); ListGridField workingHourStdField = new ListGridField("workingHourStandard", "STD"); ListGridField workingHourActlField = new ListGridField("workingHourActual", "ACTL"); ListGridField arhField = new ListGridField("arh", "ARH"); ListGridField prodUnitStdField = new ListGridField("prodUnitStandard", "STD"); ListGridField prodUnitrActlField = new ListGridField("prodUnitrActual", "ACTL"); ListGridField utilizationField = new ListGridField("utilization", "Utili<br>zation"); ListGridField efficiencyField = new ListGridField("efficiency", "Effi<br>ciency"); ListGridField utilEffiField = new ListGridField("utilEffi", "Util-<br>Eff"); ListGridField exDownField = new ListGridField("exDown", "EX<br>Down"); ListGridField diffFtField = new ListGridField("diffFt", "Diff-<br>FT"); ListGridField diffReField = new ListGridField("diffRe", "Diff-<br>Re"); ListGridField diffQaField = new ListGridField("diffQa", "Diff-<br>QA"); ListGridField handlingField = new ListGridField("handling", "Hand<br>ling"); ListGridField retestField = new ListGridField("retest", "Retest"); ListGridField qaField = new ListGridField("qa", "QA"); ListGridField handlerField = new ListGridField("handler", "Handler"); ListGridField materialField = new ListGridField("material", "Matl."); ListGridField engrField = new ListGridField("engr", "Engr"); ListGridField setupField = new ListGridField("setup", "Setup"); ListGridField testerField = new ListGridField("tester", "Tester"); ListGridField noSchdField = new ListGridField("noSchd", "NO_<br>Schd"); ListGridField pmCalField = new ListGridField("pmCal", "PM/<br>CAL"); ListGridField noWorkField = new ListGridField("noWork", "NO_<br>Work"); ListGridField hdTemField = new ListGridField("hdTem", "HD/<br>TEM"); ListGridField otherField = new ListGridField("other", "Other"); ListGridField excludeMatlExField = new ListGridField("excludeMatlEX", "Exclude <br>Matl/EX"); listGrid.setFields(platformField, totalCountField, workingHourStdField, workingHourActlField, arhField, prodUnitStdField, prodUnitrActlField, utilizationField, efficiencyField, utilEffiField, exDownField, diffFtField, diffReField, diffQaField, handlingField, retestField, qaField, handlerField, materialField, engrField, setupField, testerField, noSchdField, pmCalField, noWorkField, hdTemField, otherField, excludeMatlExField); listGrid.setHeaderSpans(new HeaderSpan("PLATFORM", new String[] { "platform", "totalCount" }), new HeaderSpan("WORKING HOUR", new String[] { "workingHourStandard", "workingHourActual", "arh" }), new HeaderSpan("PRODUCT UNIT", new String[] { "prodUnitStandard", "prodUnitrActual" }), new HeaderSpan("(%)", new String[] { "utilization", "efficiency", "utilEffi" }), new HeaderSpan("DOWNTIME(%) By CIMitar", new String[] { "exDown", "diffFt", "diffRe", "diffQa", "handling" }), new HeaderSpan("DOWNTIME(%) By Scops Manual Entry", new String[] { "retest", "qa", "handler", "material", "engr", "setup", "tester", "noSchd", "pmCal", "noWork", "hdTem", "other" }), new HeaderSpan("CDT", new String[] { "excludeMatlExField" }));
Code:
ImgButton biSave = new ImgButton(); biSave.setSize(24); biSave.setShowRollOver(false); biSave.setActionType(SelectionType.BUTTON); biSave.setSrc(Constants.IMAGE_EXCEL_24); biSave.setTooltip("Save as CSV"); biSave.setShowDown(false); biSave.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { DSRequest dsRequestProperties = new DSRequest(); dsRequestProperties.setOperationId("customExport"); dsRequestProperties.setExportAs(ExportFormat.OOXML); dsRequestProperties.setExportDisplay(ExportDisplay.DOWNLOAD); dsRequestProperties.setExportFilename(labelTitle.getContents()); dsRequestProperties.setExportDatesAsFormattedString(true); listGrid.exportClientData(dsRequestProperties); } });
Please, let me know how I can aligned it.
Thanks.
Comment