Is it possible to add two header rows in react-virtualized? - react-virtualized

Is it possible to add two header rows in react-virtualized just like in fixed-data-table? I would like to be able to have some of the columns in the first header row span a few columns to categorize the columns on the second row.

FlexTable does not allow for custom header-row rendering. However you could disable the header entirely (using the disableHeader prop) and render your own "header" above a FlexTable (or Grid) body.
app.becontentking.com does something similar to this. They use a Grid for the body (so it virtualizes the rows of data) but they render their own header row above it (so they can more easily customize its appearance).

Related

Excel Bar Graph Showing Blank Value And Its Header

I’m making a bar graph listing the amount of candidates per interview status. Ex: 1st Phase, 2 Hired,7 3rd Round, 4 etc., I have cases where some columns do not have any candidates within the current phase (Offer accepted, 0 or blank).
I made the bar graph using a range of all my headers (status) and the values (# of candidates) beneath the headers. How would I go about making my graph not display these blank values headers?
I can’t just not add the unused headers, as it is a dynamic array, pulling data from a separate table. Every time an input of a candidate and their status in the interviewing process it updates the values in my range for the bar graph.
The issue isn’t that the chart isn’t bypassing blanks but rather it is still using the header in my range when the value beneath the header is blank. Is it even possible to fix this?
Reference Photo
You can use name manager with the Offset function to create a dynamic range. This talks you through it
https://excelchamps.com/excel-charts/dynamic-chart-range/
He uses COUNTA, but I have done this with countif - I don't know which will be better for your situation
=OFFSET(Dropdowns!$K$17,0,0,COUNTIF(Dropdowns!$L$17:$L$21,">1")*1,1)

Col Span layout rule isn't working as expected

I have a customization to the AP Bills and Adjustments screen (AP301000), where I'm trying to get the Description field to span the first two columns in the header (there are three columns). Unfortunately, it moves fields from the second column over to the first, and offset from the left a little bit. Here is my customization:
Here is the header before adding the column span layout rule:
And here is the header after publication of the customization:
I've tried many different approaches, but I can't get it to simply span the two columns, while leaving everything else alone.
In my version it is already spanning two columns:
The layout is broken because the description field overlaps some of the new fields you added in the second column. There needs to be some space available in the second column for description to expand otherwise it will move the fields that overlap in the second column below description like in your screenshot.
To avoid overlap you could add some dummy label controls above description layout rule so it pushes description down below the last field added in second column:
Add enough dummy labels to make sure description position is below the last field of second column.

Update Excel ListObject header names without breaking pivots

I have an Excel sheet with a very wide table on it. Due to developer friendlyness I'd like to use a certain style of column header naming (much like proper Hungarian notation), where I suffix each header name with "column type" tags. This allows me to easily spot where e.g. apples and oranges are compared. There are also pivot table reports based on this table.
An example to illustrate this: say you have 2 monetary columns, column A being expressed in another currency than column B. The model should thus never combine them without first applying appropriate exchange rates. To spot this I name these columns e.g. Earned - Cur1 and Saved - Cur2. Any calculation like =[#[Earned - Cur1]] + [#[Saved - Cur2]] is illegal, but due to the tags this can be picked up easily in an audit. I have several such tag groups in use already, and they already prevented some errors creeping in.
However...
The file also needs to be distributed to lots of not-so-savvy end users, and they need to fill in this table and refer to some of the outcome columns. Most intermediate columns we already hide, but the column names are now far from being user-friendly (like: fill out Actual - NK/Q1/EC/%, please?).
And this needs to run in Excel 2010.
What are my options?
Option 1
Add an extra row above the table, putting human readable names in there, and just hide the table header row. This works, but not the users can't sort and filter the table anymore, so that's a no-go.
Option 2
Augment option 1 by prepending a newline to each column name, and make the table header row 1 character high. The header cells would still be there to drive sorting and filtering and the users have human readable names in the row above. The actual header cells would appear like 'empty' buttons. Could work, but then the complex formulas become unreadable due to all the newlines from the column names all over the place.
Option 3
Add a macro that switches the headers in the table by alternative headers in another row above the table. The macro should be ran just before sending out the file to the users, and ran again when they return them filled in and all. I happily coded this option into the file, and it works wonderfully! But then I realized this (and thus option 2 as well) breaks all the derived pivot tables, since Excel links the data by the names used in the table - update the name, and that section of the pivot will be dropped...
I'd really like the option of having our development-oriented column names in there when we ourselves work with the file, but being able to switch out the headers when needed. And of course without rebuilding all the pivots after each such switch.
An opening here would be that pivots seem to only drop the columns once they're refreshed. I could use this to update the header names, then do some magic on the pivots to remap their fields, and only then refresh them, but it seems there's no way from within VBA to accomplish that (PivotField.SourceName is read only).
Hopefully someone can think of an alternative, or am I SOL? I'm totally open to other workarounds.
Workaround 1
Insert null-terminating characters in the header names such that they do not show normally in the formulas, but do not show in the table header row. If only it were that simple though... Turns out Excel throws up from a =Char(0)&"abc", and things like =Char(8)&"abc" (tab anyone?) give Unicode replacement characters when pasted into a header cell... (?)
Workaround 2
A last resort seems to be to unzip the excel file, and plough through the xml data to update everything in one go there, then rezip the file. But this code also needs to be executed by less skilled users, and I see too many ifs and buts to make me feel safe using this setup.
Workaround 3
For now I just use a variation on option 2; I have some VBA that 'empties' the header cells instead of prepending a newline to them. By 'emptying' I mean setting the font size to 1, subscript, non-bold, and then make the font color identical to the background color, followed by setting it's row height to the default 14.5. The cryptic names do leak out however; column header cell drop down arrows for sorting&filtering show the cryptic name, as well as the pivot field settings and of course the formula bar when you just click such a cell. But I guess it's the best I can do?
And then again I'm probably just perfectionizing this thing faaar to much :) But from this point on it's about the challenge!
Make sure you Tick the Box "Add this data to the DataModel" when creating your pivot(s)
AFAIK when your Pivots are connected to the Datamodel instead of directly to the Range/Table you can change your column-names in the Table and your Pivot will stay fine. You could even use other names in your Pivot.

Ag-Grid column on second line of row if data exists

I am looking to implement the free version of ag-grid for displaying about 1,000 records. The records have about 8 columns that will display on the first row, but I would like the 9th column to display across the entire width of the row on a second line. It would only display if data exists. Is there a way to accomplish that with Ag-Grid?
In the free version of AgGrid you have Full Width Rows. However, you cannot have a full-width-row and a regular columns-row which both access the same data. And I assume what you are looking for is a design like this:
|___|___|___|___|___|
|___________________|
|___|___|___|___|___|
|___________________|
|___|___|___|___|___|
|___________________|
So in order to have both columns and rows, you would need to duplicate the data and do something like
function isFullWidth(index) {
return index % 2 === 0;
}
Now if you want the full-width-row to be expandable/collapsable (I assume it is for some detail information that the 9th column is too small and you want to place an expand button in that column), you have to get ag-grid enterprise for the row-grouping or row-trees.
Our team also faced that problem (data not fitting in the column) and we went for the approach of putting ngx-bootstrap-tooltip in a column, so on hover (or hammer.js-gesture) you see a tooltip.

How to Differentiate a Data from a Column/Header in an Excel File

I hope someone can help me come up with an algorithm.
Im still very new with Apache POI and I was assigned to come up with an algorithm on how to read a template (Excel) and extract the headers/column names from the data itself.
The following must be taken into account:
There can be multiple headers/column names in just one sheet of an Excel file.
Headers can be horizontal AND/OR vertical in nature. This means that there could be a mixture of vertical and horizontal headers in one sheet.
Headers dont necessarily have to be at the very first row of the file. There could be introductions or banner images there.
The system must allow ANY kind of Excel format, so there is no control over the formatting of the cells, the naming convention, etc.
Some headers are alphanumeric in nature, which means it also contains numbers.
Some cells are merged to make room for a specific header.
Any ideas and suggestions are very much welcome. Just let me know if you have further clarifications.
(I know nothing about Apache, but some about Excel Interop working)
If the sheets to be detected are yours, I'd recomend NAMING those header cells. (To name a cell in Excel, there's a field at the top left of the screen, where normally the cell coordinates appear (like "A1" or "B2" and so...). Type a name in that place, and you will be able to identify that cell via code by it's name. ( 'Worksheet.Range("Name")' is where you get those cells via code)
To manage names, go to "Insert - Names" or "Formulas - Name manager", depending on what version of excel.
(Personally, I never work with sheets via code without naming headers, then I use "Offset" to get the data cells corresponding to those headers - This allows me to freely edit the sheet later without breaking the code)
If the sheets aren't yours, then, you'll need to find out the extents of the data. (Last row and last column)
Then check for the first line that contains all columns filled, none of them blank. That's a probable horizontal header.
As well as check for the first columns that contains all lines filled. That's a probable vertical header.
You could, as well, search for completely blank lines and/or columns to find headers that are AFTER some data, in case of sheets containing multiple horizontal headers, or vertical.
You could use some formatting properties (Range.Interior or Range.Font for examples) of those cells to identify if they are headers (usually headers have different format, color, borders and so on).
If you're sure there's no numeric header, I mean, all headers contains text, check for the type of data in the cells. If all are strings, header probability increases.
Even so, that's a tricky thing to do, if sheets don't follow some pattern, once in a while one of them can deceive your code and bring false results. I'd recommend, if alowed, to add a human verification to confirm the results after the proccess is done.
The solution to this problem involves taking away two of these freedoms. Such constraints applied will make this a tractable problem. Most of such freedoms come from overcautious thinking.
The freedoms are given as quotes below:-
Headers can be horizontal AND/OR vertical in nature. This means that there could be a mixture of vertical and horizontal headers in one sheet.
Typically, vertical headers are not used in Excel Files where there is a need to programmatically detect headers. As the primary, most common and sometimes the only reason for such detection is to upload/transform the tabular data.
Funny things happen when vertical headers are introduced:
They become Labels of Forms. This implies that such forms are used for data entry rather than storage. The data from such forms is stored in horizontal/columnar headers and rowwise/vertical records of data . Thus obviating the need for Upload/Transformation of the data entry sheet.
Excel is designed to have only horizontal headers. Vertical Headers cease to have autofilter support.
Even when Vertical Headers are present, a top horizontal header row can still be introduced to mark the headers themselves as descriptions / categories.
Staying true, to the core need for autodetection of headers, we can state that once our requirement states that Headers can be placed only in a horizontal alignment, the solution becomes slightly more tractable but not fully so.
Some cells are merged to make room for a specific header.
Merging cells is poison and anathema to the entire reason for transformation/upload of data. This is a pill I steadfastly have refused to take in my entire career with Excel & SQL jugglery. You may kindly merge all that you want to for all I care, however thee shall not pass into my beloved SQL Server.
For aforementioned reasons of prejudice and ill-will towards all mergers and mergees alike. I'd respectfully suggest that you too take this course.
Solution
Staying true to the above requirements after taking away the 2 freedoms. The pseudo algorithm (solution) is to
Take a sample of say c x r Excel Rows. For eg: 200 x 201 rows and columns
Find the counts of non-empty cells using an inbuilt formula like COUNTA whose contents have a non-zero length. The Count of such non-empty cells in each row is maintained as a data structure.
The type of data ie:- Number, Date, String should also be maintained in the above data structure capable of expressing the following:
Row# 22 contains
30 non-empty cells of which
28 are alphanumeric,
1 is a Date and
1 is a Number.
The First specific row that contains the maximum number of such non empty cells with the maximum number of strings should very likely be the header row.
Converting all of the above to a specific algorithm in any given language should be a deliciously occupying task for any young developer in their prime.

Resources