Getting to know the Web Controls
Lesson 22 - cWebGrid
In this lesson we’ll look at the WebGrid control in DataFlex. The WebGrid is a control that allows you to insert multi-column and multi-row displays into your application. Each of the columns in a grid are represented by a column object. For example, WebColumn, WebcolumnButton and WebColumnCheckbox. A WebGrid can be used with and without databinding. When used with databinding, the rows and columns are populated by the server data dictionary object. When used without, you can fill the values by reading or writing the control value. The WebGrid is handy to use when you need data inside of a list to be editable. If you do not need to edit any data in a list, you should use WebList instead. Now that you know more about the WebGrid, I will show a demo on how to implement it and how it looks.
DEMONSTRATION
- For this example I have copied the WebOrderMobile example to another workspace.
- Now we are looking at the SelectSalesPerson view.
- Inside of this view we already have a WebList class. But lets say we want to edit the name of a sales person without opening the ZoomSalesPerson view.
- First let's add an action button to our WebMenuItems so that we can actually save the data we are going to change.
- This will be a simple WebMenuItem that fires a Request_save whenever it is clicked.
- Now the second step is to change the WebList to a WebGrid, in order to do this simply change the cWebList in the code to a cWebGrid.
- For this demo disable the pbServerOnRowClick, otherwise we will be navigated to the ZoomSalesPerson whenever we click a row.
- Now that that is done recompile the program and navigate to SelectSalesPerson.
- If you click on the name of a sales person now, you will see we get the option to change the value.
- Lets change the value of Alina Suarez to Alina Test. After you have inserted the new value press the save button on the top.
- If we refresh the page we will see that the information we just changed has been saved, you can also navigate to the ZoomSalesPerson by pressing the I button at the end of the row. Inside of the ZoomSalesPerson the name will also say Alina Test.
- You should keep in mind that you cannot use this to change key values in a table.