jdorn / json-editor

JSON Schema Based Editor
MIT License
5.81k stars 1.08k forks source link

min/maxLength clarification and grid formatting for tables #224

Open kamikasky opened 10 years ago

kamikasky commented 10 years ago

In commit f91c9c0, why is the value divided by 5? What do the minLength and maxLength represent? Is it basing it off pixels, or the 12 grid system used in the code?

I've been struggling with getting tables to work nicely with the grid format. For whatever reason, If I have two strings and a table array, it makes each editor a width of 4 and puts them all on one line. This looks absolutely awful because of the squished table.

jdorn commented 10 years ago

Dividing by 5 is a hacky way to convert from number of characters to number of grid columns. So, a 10 character long string fits best in 2 grid columns. I just cleaned up tables so they should choose a better grid size now.

I'd like to eventually add more control over grid sizes. Ideally, the defaults would work for most people and you could override individual editors with something like this:

{
  "type": "array",
  "format": "table",
  "options": {
    "grid_columns": 8
  }
}
kamikasky commented 10 years ago

I agree. Giving the user an option like "grid_columns" (which you didn't clarify, but I'm assuming is based on the 12 grid system?) would be perfect.

I'd say right now that even incorporating the title length is a bit hacky. Ideally, the default would either span 3 or 4 columns, and if a title interferes they can use the manual option to extend the grid size. Is it really so common for a title to be longer than the input itself?

MarioBinder commented 9 years ago

is the grid_columns feature already supported?

ecamaj commented 8 years ago

This is not working as I can see?