SimonBiggs / scriptedforms

Quickly create live-update GUIs for Python packages using Markdown and simple HTML elements.
Apache License 2.0
508 stars 34 forks source link

View tables with non-numerical fields #190

Closed olivercrask closed 6 years ago

olivercrask commented 6 years ago

Hi,

At the moment it seems that tables only support numerical fields. Would it be possible to have them display text when reading from a database?

In addition, an option to view tables without being able to edit them would be nice too.

image

SimonBiggs commented 6 years ago

I agree on both points. What I need to to is implement ag-grid which is tracked at the following issue:

https://github.com/SimonBiggs/scriptedforms/issues/106

It has a great material design option. It will fit very well with ScriptedForms. Once I've implemented ag-grid I just need to map the Python variables across.

It did keep getting bumped further down my list, but I can put it into high priority if you would like?

olivercrask commented 6 years ago

Seems like a key feature for forms, so would be useful having this as higher priority

Cheers for the rapid responses!

SimonBiggs commented 6 years ago

Yeah. It is a key feature. At the moment I only have a few hours a week to spend working on this so I need to pick what I work on carefully. In about three months we will seriously be ramping up our usage of ScriptedForms at work meaning not just home time will be dedicated to these sorts of things.

Im looking for people who can work on ScriptedForms with me if you know anyone?

This particular feature is made worse because it needs quite a dedicated session. So I need to balance that with wife and kids :).

SimonBiggs commented 6 years ago

Alright, so I looked into ag-grid. It was not what I thought it was going to be. So I'm going to be sticking to angular material grid.

For now would it be enough if there was just string and number? I can deal with booleans at a later date.

And then maybe I can add a parameter "column-lock" or something, accepts a python list, if values in the list match a column then that column is read only.

What are your thoughts? Do you have a better name for the parameter that makes columns read only?

SimonBiggs commented 6 years ago

@OxygenLithium Alrighty, so the development version of ScriptedForms now accepts each of the pandas table json schema types:

https://github.com/pandas-dev/pandas/blob/a00154dcfe5057cb3fd86653172e74b6893e337d/pandas/io/json/table_schema.py#L32-L60

There are still a few bugs with it though. If you could take it for a spin and see what bugs you can find. See if we can squash em ready for a release.

SimonBiggs commented 6 years ago

@OxygenLithium if you run pip install --pre scriptedforms then you will be able to use the following:

Column input types

<variable-table inputTypes="{'column_name': 'readonly'}">variable_name</variable-table>

The inputTypes parameter accepts a Python dictionary. Keys are column names, and items can be any of readonly, string, number, tick, toggle, or dropdown.

If inputTypes isn't provided then it tries to select an input type based on the pandas column type.