What I’m trying to do: Developing app with 50+ tables
My Question: I wanted to know if anyone has suggestions regarding the best way to create 50+ tables and corresponding Data Grids. Not sure if I should create a custom Data Grid for each table, or create a few Data Grid templates to apply to each table. Or, if anyone has any better ideas, I would love to hear them. Just trying to take the path of least resistance Thank you.
50+ tables
I like to keep the number of tables to a minimum and the number of columns on each table to a minimum. I put the bulk of the data in simple object columns.
For example I’m working on an app to manage trucks containing crates containing items of different types. There is only one Trucks table with a few columns that allows me to find the truck I need. The table has a few simple object columns with all the data I need about a truck. The data in each truck is versioned, so I can see who and when loaded what in what crate of what truck, and all the steps of each item through each department until the item is loaded in a crate and the crate in the truck. Large trucks can have hundreds of versions with hundreds of items and their simple objects can exceed 1MB of size.
The app has about 20 datagrids on both user forms and forms intended to be rendered to PDF.
50+ datagrids
In this app I created 20 distinct datagrids, each with its own template form, because they are highly customized. Some have nested repeating panels to show the items inside the crates inside the trucks, and some have canvasses to show the graphic representation of the crate content. So there was no way to make it simpler.
But in other simpler apps, where the datagrids are all similar, I use something like this DataGridJson. The advantage is that it creates the row template under the hood and manages simple click events for me. The disadvantage is that the resulting datagrid is pretty basic.
I use it as is in prototypes, then, when it’s time to go to production, I either customize it for the specific app or switch to the normal datagrid and its tedious setup. Perhaps you could have a look at it and improve it to match your requirements, assuming that your datagrids will be similar enough.
Another solution could be the Tabulator instead of the datagrid. I have never used it because I have either very simple cases where the datagrid is just perfect or very complex cases where the Tabulator can’t be customized enough, but it could be a good alternative that doesn’t require template forms.
My guess is that my little quick and dirty custom component doesn’t even compare to anything tested and used in the outside world, like SyncFusion or Tabulator.
The only advantage of my DataGridJson is that it’s 100% Anvil, 100% Python and 100% under my control.
If I don’t like how it behaves on the next app, I clone it and modify it without messing with using external tools and making sure they play nice with my app and customizing them with whatever language they need to be customized with.
That’s why I use Anvil: my productivity comes first, a good looking app comes second
(My apps are (mostly) for internal use)
I like to keep the number of tables to a minimum and the number of columns on each table to a minimum. I put the bulk of the data in simple object columns.
Would you mind sharing some of your code you used to store the data in the tables/columns? Would really appreciate it.