Getting to know the Web Controls
Lesson 7 - WebColumnCheckbox
The WebColumnCheckbox is an object, used to add a click-to-toggle control in your WebList or WebGrid. The WebColumCheckbox is only editable in a WebGrid because a WebList is readonly. A checkbox is mostly used to display true-false or yes-no values and appears as a square box which you can click on or off. The appearance of the box indicates whether it is checked with a checkmark. The OnChange procedure must be implemented to save the change direct to the database. Let me show you how I worked this out in the next example.
- This example demonstrates a web view containing a data dictionary and a WebGrid whose rows and columns are populated from the data dictionary.
- The WebGrid is augmented with the OnLoad event to ‘seed’ the data when it is loaded for the first time.
- First let me show you how to implement the OnChange procedure in the object.
- I created a checkbox for the active column of the customer. I want to save the changes immediately to the database if I change the value of the checkbox. This can be done with the onchange procedure. I don’t have to check if the value is changed, because this is always the case with a checkbox in this context. A simple request_validate and request_save is enough to save the changes. Other changes made in the row of the grid are automatically saved.
- It’s also possible to check if a checkbox is checked or not. You can use the GetChecked function and SetChecked procedure for this.
- This demo demonstrated how easy it is to implement checkboxes in a webgrid.