Problem with row selection: Same row, different column [message #1004983] |
Thu, 24 January 2013 09:06 |
Andreas Saremba Messages: 5 Registered: January 2013 |
Junior Member |
|
|
In my plugin using NatTable for a list of work items, I have three additional views to show the details of the currently selected item; depending on the column selected by the user, the selected item (=row) is shown in the appropriate detail view. That works fine as long as I select a different row each time; but when I select a different column in the same row, the details view remains unchanged. My customer refuses to accept this.
Searching for the reason I found that the base class for my CustomRowSelectionProvider, the NatTable class RowSelectionProvider has a method handleLayerEvent that informs the change listeners if and only if the selected row has changed. This does not take into account my special case where column selection is significant. To make things worse, I cannot even override handleLayerEvent in my derived class because it uses private variables.
I do not want to argue whether this is a bug or just a rough edge of an otherwise wonderful library. In any case, I suggest to make the RowSelectionProvider more flexible, providing some means to allow for making column selection significant.
Of course, one always has the workaround to copy the source code, change the affected method and add any special behaviour needed - which is what I did, of course. But this is not OOP, right?
|
|
|
Re: Problem with row selection: Same row, different column [message #1005125 is a reply to message #1004983] |
Thu, 24 January 2013 14:21 |
Dirk Fauth Messages: 2902 Registered: July 2012 |
Senior Member |
|
|
Hi,
well IMHO the RowSelectionProvider is doing what it is supposed to do, it provides information about the selection object represented in a row in NatTable.
What you need is some type of CellSelectionProvider, which is not provided by NatTable core. The reason for not providing something like that is, that you also need to implement setSelection() if you create your own ISelectionProvider, and with only having the Object value of a cell, you can't determine to which cell it should belong. With rows and the RowSelectionProvider that uses a IRowIdAccessor, it is possible to determine what to select.
Of course it is not a good OOP principle to copy and modify code. But it is also discussable in framework creation if everything needs always to be visible and accessible.
Nevertheless, if you solved the issue I tried to explain above then please feel free to contribute. We are an open source project and would appreciate any help with such things. If you have a more local solution that only fits your needs, than please tell me which member variables need to be accessible, so I will have a look what I can do. Also a little explanation with code could be helpful to understand how you solved your issue locally.
Greez,
Dirk
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03076 seconds