jan-vandenberg / cruddiy

No-code Bootstrap PHP CRUD generator
http://cruddiy.com
GNU Affero General Public License v3.0
253 stars 80 forks source link

Check/uncheck All and generation of forms #123

Open starapple2 opened 10 months ago

starapple2 commented 10 months ago

A couple of matters of clarification:

  1. I am generating pages primarily for the adding of new records and I see the two check boxes to Check/uncheck all columns in a table. What is the purpose of the second of the two? When I click on the first box it toggles the selection of all columns. I don't grasp what the second one does. check-uncheck-Columns
  2. My second query is with regards limiting what columns are displayed as fields in the generated forms, which I thought was affected by the Show column function.

The tables I am working with have fields that are restricted to back-end (admin) users after forms are submitted by public-facing users. It seems I would have to edit the generated forms to prevent the showing of fields such as table IDs, account status, time stamps or text areas for admin notes.

In summary, what is the purpose of the second toggle and can one decide what columns are generated as form fields? The completed app from the image above would correctly show an HTML table without the account_id column but the account-create.php would display the account_id field.

Is the ID field set depending on whether the column is auto incremented, because the behaviour isn't consistent with all column IDs? The setting here: image

Results in (although other columns not selected also are in the form): image

germain-italic commented 10 months ago
  1. What is the purpose of the second of the two?

The checkboxes under "This table" are used to display the selected column in the list view of each table.

If you had foreign keys in your schema, you would see "Related tables" in column #2. It would be used to display the selected column when it is referenced as foreign key in another table. Columns keys id, name, reference are checked by default.

Here's an example:

_This will show a countries.name column on users-index.php (without countries.id column)_

I have some ideas on how to improve this, will implement in the coming weeks.

germain-italic commented 10 months ago
  1. the Show column function

It changes the layout of the table onto the generated "Read" pages (xxxx-index.php). You should already have:

The completed app from the image above would correctly show an HTML table without the account_id column

I've checked the code and I haven't seen any impact on the Create/Edit pages so far. That's a cool idea to implement.

In order to avoid breaking compatibility with existing apps, I suggest that we offer the choice. Sometimes you want a compact table, sometimes a full-fledged form.

Does it make sense? Is the wording clear enough?

We've struggled to find a presentation for this concept (see this comment and below) so any suggestion is welcome.

Is the ID field set depending on whether the column is auto incremented

The ID is passed via GET so that won't make any difference if we remove the field from the form.

We also need to hide the unchecked columns on xxxx-read.php and xxxx-update.php, right?

starapple2 commented 10 months ago
  1. What is the purpose of the second of the two?

You have spotted a glitch in UI, the second column of checkboxes should be only visible when at least one table has a foreign key.

The checkboxes under "This table" are used to display the selected column in the list view of each table.

If you had foreign keys in your schema, you would see "Related tables" in column #2. It would be used to display the selected column when it is referenced as foreign key in another table. Columns keys id, name, reference are checked by default.

Here's an example:

_This will show a countries.name column on users-index.php (without countries.id column)_

I have some ideas on how to improve this, will implement in the coming weeks.

I suspected as much that it was related to the presence of foreign keys. The original db as MyIsaam and the two columns of and I thought after reading the user guide that that should not be the case if the tables were InnoDB; so I changed them to InnoDB and the behaviour didn't change.

I think we're on the same page with your 2. re showing/hiding.

Best.

germain-italic commented 10 months ago

Do you actually have a foreign key?

Does the relation appears (or has been created) on in step2?