Need some advice with using SpreadSheetView.

202 views
Skip to first unread message

Kriangkrai Wachirarattanakornkul

unread,
Dec 3, 2017, 1:54:20 AM12/3/17
to ControlsFX
Hello development team,

First of all, I would like to give my both thumbs up for this marvelous project. I just discovered this a week ago and started trying it out.

I'm developing a new version of my company's tiny internal software, which was mainly coded GUIs using swing. In this new version, I decided to try Javafx. My users love to use every tables in MS Excel style and I think ControlsFX's SpreadSheetView will be most suited. But there're some issues for me, so I will begin with my questions.

(Reference to release 8.40.14)

  • Is column sorting feature in this version? like clicking column headers to sort the whole spread sheet based on that column value.
    The discussion here is exactly what i need, if it's possible, would you provide a guideline on how to achieve this?

  • Can I use SpreadSheetView with custom object types? I found a discussion here suggested that we have to create a custom SpreadsheetCellType but I still confused with events. I wish to know if I could add a custom commit event so I can add a link to my object and the other way around. I did create a column mapper class to track and get object from map, for example..

    I have object A with 5 fields, fields 1-5 with get & set methods
    So when I create a SpreadSheetView, I add column headers with grid.getColumnHeaders() based on object fields then populate the grid by iterating through my object list, putting its fields into columns. I did manage to show data perfectly (using cell type as just String)

    What I want to achieve next is to know more on how to create a custom SpreadsheetCellType  so I can also commit the changed values back into the object itself, with the help of my custom column mapper the tableposition should know what field of the object the edited cell is belong.

    Could you guys advise me on this?

Thank you in advance for your kindly responses.

samir.ha...@gmail.com

unread,
Feb 6, 2018, 8:36:42 AM2/6/18
to ControlsFX
Hi Kriangkrai Wachirarattanakornkul,

Sorry for the delay, I don't know how I missed your post. I hope it's not too late.

Regarding your questions:
- Sorting is feasible in this version. Although it is not provided like the TableView. We tried to do the same thing MS Excel is doing. And as you may notice, Excel is not sorting on the column header. You simply select a cell and define it as a column header, and then you can sort all the values below that cell. That's exactly what the SpreadsheetView is providing with https://controlsfx.bitbucket.io/org/controlsfx/control/spreadsheet/SpreadsheetView.html#getComparator--

- You can use custom object with the SpreadsheetView. Regarding your question, you have a Event fired every time a cell is modified. You may take a look to https://controlsfx.bitbucket.io/org/controlsfx/control/spreadsheet/GridChange.html
With this event, you can know when a cell is modified and with which value.
Now if you want to closely monitor the changes, you can either create a custom SpreadsheetCellType or/and a custom SpreadsheetCell.

Let me know if you need more help, don't hesitate to look into the documentation. Don't hesitate to post some small code of snippets so that I can help you the best I can.

Regards,
Sam'
Reply all
Reply to author
Forward
0 new messages