-
I'm attempting to rewrite a golang web application to use cogertcore for the UI. Old / current UI: Cogentcore UI rework: As evidenced by the pictures above, the old UI has links in a table with individual pages containing data that the user may want to look at. An example of one linked page: Cogentcore is basically optimized for a single page application - unless one uses "cogentcore.org/core/content" The "cogentcore.org/core/content" import may not be suitable for my purposes as the data being looked at is not static, but generated daily, and updated or recalculated hourly. I've been looking at different potential alternatives in order to make the data accessible in the single page application context, but I can't seem to figure out how to include any widget or button inside the table. I'm not sure it's possible, currently. I think the best options are as follows, to display the data shown in the third image:
It should be possible to have a link in the table to show the data on a new page, but this is generally a navigational challenge and I'm not sure how to integrate that with the cogentcore app. For example if I link to Also, how can I get the table or tab content to take up the whole vertical space? It's cut off halfway down the page. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 15 replies
-
I've worked around the need for buttons in the table, and I found the solution to the larger navigational issue using pages - which are actually not well documented. However, the sign-in tutorial demonstrates it's usage. After that, it's been both easy and fast to get the general layout and behavior as desired. |
Beta Was this translation helpful? Give feedback.
-
@0pcom As you figured out, You can define a type, such as type DateButton struct {
core.Button
}
func (db *DateButton) WidgetValue() any { return &db.Text }
func (db *DateButton) Init() {
db.Button.Init()
db.SetType(core.ButtonTonal)
db.OnClick(func(e events.Event) {
// open the other page you want
})
} Then, the key step is to, in an If this doesn't work for you, please let me know and I can help figure it out; it should definitely be possible. I will document this process soon. |
Beta Was this translation helpful? Give feedback.
@0pcom Okay, here is a full example for how this can work. This code makes a table with buttons for the dates, and then clicking on one of those buttons takes you to a page with more details for that date (using
core.Pages
). Please let me know if you have any questions; I can give an example with links instead of buttons if you want. I will add this example to the website soon. I will respond to your questions about updating next.