Adding, Editing and Deleting

 | Part 

6

PREVIOUSNEXT
Copy the finished template here!

Allowing your users to add, edit, and — if you're feeling really brave, occasionally delete data — opens up a whole new dimension for your apps and the ways they can be used.

We’re going to look at four things:

  • ​Editing​
  • ​Adding
  • ​Special values
  • ​Deleting

Editing

Some components are editable by default. In other words, anyone who can access your app can edit them, even if you haven’t enabled editing. For example, components like; Choice, Image Picker, Notes, Number Field and Phone Field are all editable components.

If you want to allow your users to edit entire list items, then you can enable Allow editing. To do this, navigate to the details screen of a list item and click Allow editing. Now you can allow your users to edit all or some of the data which appears in your app.

Enabling editing in your app

When you click the edit button in Glide, two things happen

  1. Firstly, the app changes to show you the edit page
  2. Secondly the components panel on the right changes to show a new set of components that are your edit screen components.

Glide will add these edit screen components automatically, based on the columns in your sheet, but you can customize these to change what data can be edited.

Glide automatically adds edit components based on your columns

Now your users can edit each of your list items and these changes will flow up to your sheet. When they finish editing, their changes will be reflected in the original set of components.

If you want users to only be able to edit certain columns, you can delete these from your edit screen component list. For example, if you delete the Text Field which is bound to the Title column - users will no longer be able to change the name of your list items, but can still change all the other data.

Preventing users from editing the 'Name' by deleting the corresponding edit component

You can enable editing individually for each tab, so you can allow users to edit certain tabs and not others.

Enabling edit on the Cookies tab 🍪and not the Muffins tab 🧁

Adding

When you enable Add item, users can add data to your sheet. Like Allow editing, Add item is tab specific, so you can enable add item for some tabs and not others.

Adding an item brings up the same editable component list that we had on the edit item page. What you change in this component list will be reflected in the edit item list as well. For example, if you delete the Text Field which is bound to the Title column, this will also be reflected in your edit item screen.

Similarly to editing, you give users access to only certain columns when they add items. For example, if you want to allow users to add places to visit in a city guide app, but don’t want them to be able to choose a category for their submissions, you can make sure the Category column is not bound to an edit screen component.

Special values

When a user adds or edits an item, Glide can submit additional data about their submission, like the date and time of the user’s submission or the user’s email address. These are called Special Values.

If we add the date and time special value, we don’t see anything in the app but we do see the value listed on the right under the Values section.

Adding a Current Date/Time special value

We can then choose which column we want the date and time submitted to or create one for it and bind the Date Time value to that column. Now when a user submits data — whether through editing a list item or adding a new list item — our new column will be populated by the date and time that that user submitted the information.

Glide updating the sheet with the current date & time

Glide will always be able to work out what time and date it is for the user's device, but Glide will only have access to the user's email if you have set your app's sign in to be Public with Email or Email Whitelist (or if they’ve already been prompted to sign in by another action like Favorite). Otherwise, it will just stay empty. It won't prompt the user to sign in.

Two things to note about Special Values:

  1. If another user edits that item again, then the Special Value column data will be overwritten, so you will only ever see the last edited special values.
  2. Special values only work the add or edit screen. If you haven’t enabled editing or adding items and a user changes an editable component, Glide won’t be able to populate your sheet with the date & time or the user’s email.

Deleting

If you want your users to be able to delete entire list items, open the edit screen in the app, head to the edit components panel on the right and enable allow deleting. When a user deletes an item, this cannot be undone in Glide or in your sheet - so make sure whoever is using your app knows this.

Glide clears the row in your sheet, it doesn't delete the row.

If you want to restrict your app to only be used by certain people, then you can of course change the sign in settings.

Deleting possibly the best cookie idea in the history of time... 🍪🍪


PREVIOUSNEXT