I am using AG/IG v 12.3.
My basic use case is a comparison of 2 time-based scenarios with a dynamic horizon (production projections for 2 years starting different time periods). This produces 3 rows (projections_q1'22, projections_q2'22, difference) for each mapping (product at a production facility) within either scenario (they are matched, even when data isn't present in one of the scenarios). The current columns-making process is as follows:
buildColumns(param:string, shorter:boolean, compareTimePeriods:string[], source:string) { let formatColumnData = (value:any) => { if (value !== null && value !== undefined) { if (param.indexOf('PB') > -1 || param.indexOf('EB') > -1) { return value.toFixed(5); } else if (param.indexOf('(%)') > -1) { return (value.toFixed(9) * 100).toLocaleString() + '%'; } else { return value; } } else { return null; } }; let columns:column[] = [{ field: 'Design', type: GridColumnDataType.String, pinned: true, width: '110' }, { field: 'Family', type: GridColumnDataType.String, pinned: true, width: '80' }, { field: 'Facility', type: GridColumnDataType.String, pinned: true, width: '80' }, { field: 'Process', type: GridColumnDataType.String, pinned: true, width: '75' }]; if (source !== 'UOM') { columns.unshift({ field: 'Scenario', type: GridColumnDataType.String, pinned: true, width: '250' }); } if (param.indexOf('%') < 0 && param.indexOf('(days)') < 0 && param.indexOf('AVG') < 0) { columns.push({ field: 'Total', type: GridColumnDataType.Number, pinned: true, width: shorter ? '90' : '125', formatter: formatColumnData }); } compareTimePeriods.forEach(w => columns.push({ field: w, type: GridColumnDataType.Number, pinned: false, width: shorter ? '80' : '115', formatter: formatColumnData })); return columns; };
Users will now have the option to stitch in data from a third scenario, the actual production values The actual data can be stitched into either or both projection scenarios, and the projection data can start at any workweek within the total horizon (chosen start week within Actual data horizon through last workweek chosen, up to the last workweek of the later projection scenario).
Users would like to see the actual data highlighted in a subdued yellow/orange (background) color. I imagine the logic to decide whether it should be highlighted should look something like this:
scenIndex = rowIndex % 3; if (columnName < starts[scenIndex] && scenIndex < 2) { cell.highlight(); }
The implementation at the row level seems a bit beyond the available example.
Hi Riva Ivanova,
Currently I am using grid with igx-column options, I want to hide or remove cells based on the conditions. Is there any possible way to achieve this requirements?
Thanks in Advance.
Regards,
R.Madhavan
Ugh, incompleteness on my part and simple mistakes. I forgot to change the name in the HTML template, as the grid was good enough to simply copy over from a previous component.
However, I do not think adding to the GitHub repo will do anything, as the last suggestion I put there (dotted lines in charts) was closed without attempt at implementation, despite being highest user-voted new feature.
Hello Chris,
I have been looking into your question and what I could say is that at this point we do not provide exporting the grid with custom cell/row styling. What I can suggest in order to have this feature implemented in any of our future releases is logging this as a feature request in our GitHub repository here. Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case.
Additionally, I have prepared a small sample trying to reproduce the described behavior. However, on my side, I was not able to reproduce the described behavior and the Excel file is downloaded successfully. After reviewing the provided snippet from the console log, what I could say is that the most common reason for receiving such an error is if the selector provided in the ViewChild is not equal to the one assigned to the IgxGrid in the html file.
For example:
<igx-grid #grid [data]="data" [autoGenerate]="true"></igx-grid>
@ViewChild('grid1', { read: IgxGridComponent, static: true }) public grid!: IgxGridComponent;
Here could be found my sample for your reference. Please test it on your side and let me know if you need any further assistance.
Looking forward to hearing from you.
Sincerely,Riva IvanovaEntry Level Software Developer
Unfortunately, I feel I must bother you again. The download (export to Excel) feature seems to be broken with the coloring applied. Here is the complete output:
ERROR TypeError: Cannot read properties of undefined (reading 'columnList') at IgxExcelExporterService.export (main.js:126115:24) at StitchComponent.download (main.js:1293921:37) at StitchComponent_div_18_button_2_Template_button_click_0_listener (main.js:1293589:23) at executeListenerWithErrorHandling (main.js:35182:12) at wrapListenerIn_markDirtyAndPreventDefault (main.js:35233:16) at HTMLButtonElement.<anonymous> (main.js:67185:34) at ZoneDelegate.invokeTask (polyfills.js:11323:173) at Object.onInvokeTask (main.js:50995:25) at ZoneDelegate.invokeTask (polyfills.js:11323:56) at Zone.runTask (polyfills.js:11073:39) defaultErrorLogger @ main.js:24740 handleError @ main.js:24793 handleError @ main.js:30164 executeListenerWithErrorHandling @ main.js:35184 wrapListenerIn_markDirtyAndPreventDefault @ main.js:35233 (anonymous) @ main.js:67185 ZoneDelegate.invokeTask @ polyfills.js:11323 onInvokeTask @ main.js:50995 ZoneDelegate.invokeTask @ polyfills.js:11323 Zone.runTask @ polyfills.js:11073 ZoneTask.invokeTask @ polyfills.js:11418 invokeTask @ polyfills.js:12863 globalZoneAwareCallback @ polyfills.js:12894
It basically breaks at this point in my code (specifically on the export line), which is no different from other pages which do not produce this error:
download() { let param:parameter = parameters.filter(p => p.name === this.uomParam)[0], name:string = `${param ? param.short : this.uomParam}`; name += this.scenario1Name === this.scenario2Name ? '' : `-${this.scenario2Name.slice(0, this.scenario2Name.length < 20 ? this.scenario2Name.length : 20)}`; name += `-${this.scenario1Name.slice(0, this.scenario1Name.length < 20 ? this.scenario1Name.length : 20)}` name += `-${this.rollup}-${new Date().getTime().toString().slice(8,13)}`; console.log(`Exporting stitch ${name} to Excel.`); this.excelExportService.export(this.stitchGrid, new IgxExcelExporterOptions(name)); };
Users would like to see the coloring applied to the Excel sheet which is produced, if possible. Otherwise, it seems there should be a way to reverse the coloring to make it exportable.
I am glad that you find my suggestion helpful and managed to achieve your requirement.
Thank you for using Infragistics components.
Regards,Riva IvanovaEntry Level Software Developer