Hi,
In our project we are using a collapsible group of columns. When adding a new row, it seems that if you interact with the expand/collapse icon, the RowEditExit event is triggered, so if someone gets halfway through entering information and decides to expand or collapse those columns (some of which are editable) this loses their work. Is there any way to prevent this from happening, just to keep the edit mode active regardless of the collapse state?
Thanks!
Adam
Hello,
Thank you for getting back to us, and I completely understand your decision. Sometimes, simplicity is the best approach, especially if it saves time and effort in the long run. It's great to hear that you found a workaround that meets your needs.
I'm glad if you found my responses helpful. If you have any more questions or need further assistance in the future, feel free to reach out.
Regards,
Georgi Anastasov
Entry Level Software Developer
Infragistics
Sorry for the delay in getting back. I have decided that what I'm trying to do isn't really supported by the grid, so I'll use a simple workaround where the columns will always expand on adding/editing - that way there's no way for the user to encounter this error. Thanks for all your help, if it was just editing it might have been feasible but like you say, it would be quite verbose and probably not worth it.
Thanks,
Hi Adam,
As my teammate Georgi is currently out of office I will assist you in the meantime.
I scanned through your discussion so far and in response to your latest comment, I have forked and modified the previously suggested sample with additional logic to tackle this.
As you will see, a workaround approach like this involves some quite verbose code to handle this. Additionally, while there is added additional checks for the add row not to throw the previously encountered error, fully restoring the entered values and adopting the same approach, as for an edited row would not be as straightforward to retrieve the record like this, if at all possible.
Please, note that due to the upcoming national holidays you may experience delay in replies for messages received Friday, 3rd May. Thank you for understanding.
Best regards,Bozhidara PachilovaAssociate Software Developer
So I've implemented this solution (the issue with the click event not registering is there was some rogue css setting pointer-events to none for some reason) and it sort of works while editing. What it seems to do though is cancel all the edits that have been made to the row and just restart the editing process. So if the use has input a few bits of data in the cells, these are reset when expanding/collapsing.
The other issue (which was actually the main problem as this was where we noticed it first) is that if you add a new row, this solution throws an error as the cell seems to be undefined - maybe because it isn't part of the grid yet technically?
Let me know if you have any feedback on this.
Thank you for your prompt response and for providing additional details regarding your implementation of the collapsible column group within the tree-grid component. I appreciate your patience as we work through these challenges together.
I have been looking into your questions and:
Regarding the described behavior you encountered with the click event not firing on the igx-icon, I understand this can be frustrating. In the provided sample, the click event should indeed trigger the expandCollapse method. To troubleshoot this, I made some additional changes to observe the behavior more closely.
<igx-icon [attr.draggable]="false" #target="tooltipTarget" [igxTooltipTarget]="tooltipRef" [showDelay]="0" [hideDelay]="0" (click)="expandCollapse(column.expanded)"> {{ column.expanded ? 'expand_more' : 'chevron_right' }} </igx-icon>
And the corresponding TypeScript method:
public expandCollapse(expanded) { console.log('Icon clicked.'); if (!expanded) { console.log('Column expanded.'); } else { console.log('Column collapsed.'); } this.isExpandOrCollapse = true; }
With these changes, you can now observe in the console whether the icon is clicked and whether the column is expanded or collapsed. Additionally, you can utilize the expanded parameter passed to the expandCollapse method to check if the column is expanded or collapsed for your custom implementation and logic in your project.
The described scenario could be observed here:
Regarding your further explanations about using a tree grid, it's important to note that the same principle outlined in the grid sample I provided also applies to the tree-grid component. While the functionality may differ slightly due to the hierarchical nature of the tree-grid, the underlying concept remains consistent.
Currently, the rowEditExit event cannot be stopped or canceled outright. However, it can be approached with the proposed solution. Here's how it works:
In summary, while the tree-grid component may introduce additional complexity due to its hierarchical nature, the same approach can be applied to maintain edit mode consistency and ensure a seamless user experience.
In addition, I have modified my previous sample illustrating this behavior which could be found here. Please test it on your side and let me know how it behaves.
Thank you for your cooperation.