Posted 1 December 2020, 8:13 pm EST
Hello,
Is it possible somehow to add left cells to pivot grid (row header cells) which will show the current row number in pivot grid?
Thanx!
Forums Home / Wijmo / General Discussion
Posted by: mary431982 on 1 December 2020, 8:13 pm EST
Posted 1 December 2020, 8:13 pm EST
Hello,
Is it possible somehow to add left cells to pivot grid (row header cells) which will show the current row number in pivot grid?
Thanx!
Posted 2 December 2020, 1:21 am EST
I managed to add extra column to row header part:
this.pivotGrid.updatedView.addHandler((s, e) => {
let lHasWRowNoColumn: boolean;
for (const lColumn of this.pivotGrid.rowHeaders.columns || []) { if (lColumn.name == 'rowNoColumn') { lHasWRowNoColumn = true; break; } } if (!lHasWRowNoColumn) { const lColumn = new Column(); lColumn.name = 'rowNoColumn'; this.pivotGrid.rowHeaders.columns.push(lColumn); } });
but this column apeers as last in the row header part,
and I want it to be the first column but I dont know how to do that…
Posted 3 December 2020, 6:23 pm EST
Hello Mary,
We are extremely sorry for the delayed response.
The reason that the column appears at the last because you are using the push method to add the column. This method always adds the new item in the last position. To resolve the issue, you can use the splice method:
this.pivotGrid.rowHeaders.columns.splice(0, 0, lColumn);
https://www.grapecity.com/wijmo/api/classes/wijmo_grid.columncollection.html#splice
Regards,
Ashwin
Posted 3 December 2020, 8:16 pm EST
Hello,
thanx for your reply!!
I used splice instead of push but then I get 2 new columns: one that I need with row number (in the beginning of the row header part) and other strange column in the beginning of the non-row-header-part which I dont need (and it has the values copied from another regular column)?! How that happened?
Posted 3 December 2020, 11:59 pm EST
Oh, I figured it out: I didnt get the new column in non-row-header-part, it is my usual column but its usual name has been renamed to “1” and I dont know why?
Posted 6 December 2020, 8:02 pm EST
Hi Mary,
The “1” may be displayed because the header of the column is set to 1.
I have created a sample which shows how you can add an extra column in pivot grid:
https://stackblitz.com/edit/js-dec1fd
Let me know if this helps.
~regards
Posted 8 December 2020, 9:52 pm EST - Updated 3 October 2022, 6:00 am EST
Hello, I didnt get the notice mail for your response so that’s why I am late with my reply.
Thanky you for making the example.
I have the similar code (updatedView / formatItem / merge), BUT:
I DO get the row number column BUT it is shown instead of my normal first column in the rowHeader part! It HAS the header of previous normal first column of the rowHeader part - and in the cells it has row numbers.
This is whithout row number column:
This is with:
You see - the first LS - name column got the row number values!!!
I dont understand what am I doing wrong?
Posted 8 December 2020, 11:14 pm EST
Try to expand (resize) you Country Column in your example and you will get the similar effect
Seems like it is impossible to add on our side a column to the pivot grid and everything to function well!! Can your team maybe add the functionality that pivot grid can have optional row number column?
Posted 11 December 2020, 12:00 am EST
Hi,
We are able to replicate the issue at our end and hence we have forwarded it to the dev team to confirm if there is a way to achieve the required functionality. The internal tracking ID for the issue is 469842.
We will let you know about updates regarding the same.
Regards
Sharad
Posted 11 December 2020, 12:28 am EST
Thanky you very much!!
Posted 17 December 2020, 6:13 pm EST
Hi,
Devs have confirmed that it is not possible to display row number in the header using the current version. They will be making some changes in the control to support this in the future build. I’ll update you after it is added to the control.
Regards
Posted 17 December 2020, 9:42 pm EST
Thank you very much! I’ll be waiting for your notice : )