Closed MayerBjoern closed 2 years ago
Hey @MayerBjoern,
this looks great. I agree that this should come after inline editing has been merged, but then this should be a great improvement, especially with editing tables without reloading.
I've just tried to use the current version of the branch, but when trying to use the OBME I - Updated Sample Creation schema there is key error:
File "/Users/rhiem/Work/sampledb_doro/sampledb/frontend/objects.py", line 555, in add_array_placeholders_to_data
if 'type' in sub_schema['items'] and sub_schema['items']['type'] == 'array':
When using the JSpreadsheet Example Action, when only the minimum number of rows is present, I can select a row and hit delete, there's a query about whether I'd like to delete the selected rows, but pressing "OK" does not delete anything. Deleting the row via right click also did not work. is there perhaps a way to show a different message and/or disable the "Delete selected rows" button?
Fixed the error caused by the Tags array in the JSON data
Now the Table dynamically gets reconfigured to now allow row deletion based on minItems settings. Its slightly less clear then with the greyed out red X buttons, but it's more consistent to not work with Pop-up messages here aswell.
Merged with inline-edit, can be squashed into one commit when added. (Still only affects edit mode)
Hi Florian,
let me show you what i have done this time frist and then explain:
First and foremost i have added "jspreadsheet" as a array style. Its based on the JScript Plugin JSpreadsheet - formerly known as JExcel. Currently this only effects the edit mode, but one might argue that in this case it should look the same in view mode (with inline editing especially, but maybe also in view mode as a read only spreadsheet). I will happily edit the branch accordingly then.
JSpreadsheet essentially only works as a visual Wrapper for hidden form_table inputs. It initializes its Data out of the form inputs and writes the values back on change. There is an example action in the demo data.
In order for JSpreadsheet to work this way, i had to implement an additional feature, which might also be the actual star of this pull request. You can now add and remove array items without a page reload via JS only. This stands true for every form_array template except for a table of arrays (with the add- and deletecolumn buttons). This slightly increases editing performance for more complex objects and/or if you have a lot of data stored in the object already.
I hope you like it in principle. I guess it makes no real sense to merge it into the core until inline-editing is in and i rebased the branch again, but i wanted to show it to you anyways, since i now consider it feature complete.