Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New GUI Component - Table #1107

Closed
ShlomiRex opened this issue Jun 22, 2020 · 8 comments
Closed

New GUI Component - Table #1107

ShlomiRex opened this issue Jun 22, 2020 · 8 comments

Comments

@ShlomiRex
Copy link

ShlomiRex commented Jun 22, 2020

I want to create table, like database gui, like JTable in Java Swing.
model

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
I want to pull my request: godotengine/godot#36053
(Pull request # #36053)
image

And the current file dialog uses Tree. Which is a bad choice. ItemList is preferred. Even so, a Table with dedicated Title (like in the picture) and user can click on title and sort the table.
Moreover, current solutions don't allow user to select a row and that row will be selected and highlighted. I modified the code, turns out Tree is designed that way. It only has 2 modes: Single (single cell select) and Multi (multi cell select). If I want to select a row, I need to set multi mode and select all the cells in that row. This is bad.
In the pull request I switched multi mode with Row mode. This however throws error (not crashing, just log. Other than that the code works perfectly with correct selection of files)

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
I am working on it on 3.2 on commit a662b853dd5de7d47a8c5ebee3ae35cf66490d3f (latest as of writing this post)
Though I'm not working on it full time, as I got work and university, but as side project, torwards big goal

If this enhancement will not be used often, can it be worked around with a few lines of script?:
No, need dedicated GUI component

Is there a reason why this should be core and not an add-on in the asset library?:
Yes, GUI is core feature

Another feature I want to add, after Table is ready:

  • Sort the table (with function call according to one column)
  • Sort the table (with user clicking on title) (Defenition of title: in the picture above the title is the first row, describing the column's names)
@YuriSizov
Copy link
Contributor

Moreover, current solutions don't allow user to select a row and that row will be selected and highlighted. I modified the code, turns out Tree is designed that way. It only has 2 modes: Single (single cell select) and Multi (multi cell select). If I want to select a row, I need to set multi mode and select all the cells in that row. This is bad.

Am I missing something? There is the row mode in Tree:
https://docs.godotengine.org/en/stable/classes/class_tree.html#enum-tree-selectmode

@jonbonazza
Copy link

A generic table node would be a good addition imo. A simple can be created fairly easily using a combination of a few different nodes, but packaging everything and adding advanced functionality like sorting and filtering eould be useful. Might i suggest beginning with a gdscript addon for prototyping?

@Xrayez
Copy link
Contributor

Xrayez commented Jun 23, 2020

See also #97, #13.

@fire
Copy link
Member

fire commented Jun 29, 2020

Can you describe more design for how this is different from a regular tree. I might look into this.

@aaronfranke
Copy link
Member

I don't understand why you can't use GridContainer for this. Here is a screenshot from Unknown Horizons:

Screenshot from 2020-07-02 16-37-58

Is there a reason why this should be core and not an add-on in the asset library?:
Yes, GUI is core feature

This is not a justification. GUI itself is a core feature, but this particular GUI element is not. Godot does not include every possible kind of UI element that anyone could ever want, since you can build GUI elements yourself using existing GUI elements (for example, in the above image, where a table is built using GridContainer).

@TheDuriel
Copy link

Tree is responsible for all Table views within Godot. For more complex custom systems an implementation based on GridContainer should suffice.

@Calinou
Copy link
Member

Calinou commented Feb 22, 2021

Duplicate of #97.

@Calinou Calinou closed this as completed Feb 22, 2021
@aaronfranke aaronfranke closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2022
@ePirat
Copy link

ePirat commented Sep 4, 2023

@aaronfranke How did you manage the different column widths? I tried size_flags_stretch_ratio but it seems to have no effect at all in a GridContainer...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants