How Do I Update Data In a Row?

This lesson will show you how to update data in a row.

Updating A Row's Data And Refresh Data Grid Automatically

Updating A Row's Data And Refresh Data Grid Automatically

You can update data in a row by setting the dgDataOfIndex or dgDataOfLine properties. You can set either property to an array containing the values for the row.

put "New First Name" into theDataA["FirstName"]
put "New Last Name" into theDataA["LastName"]
put "New Title" into theDataA["Title"]
set the dgDataOfIndex[ the dgHilitedIndex of group "DataGrid" ] of group "DataGrid" to theDataA

The data grid will now refresh with the new data you assigned to the highlighted index.

Updating a Row's Data Without Refreshing the Data Grid

If you want to update the data in a row without automatically refreshing the data grid then you can use SetDataOfIndex. You can use the RefreshList command to redraw the data grid in this case.

Example that sets all values at once:

put "New First Name" into theDataA["FirstName"]
put "New Last Name" into theDataA["LastName"]
put "New Title" into theDataA["Title"]
dispatch "SetDataOfIndex" to group "DataGrid" \
   with the dgHilitedIndex of group "DataGrid", empty, theDataA
dispatch "RefreshIndex" to group "DataGrid" with the dgHilitedIndex of group "DataGrid"

 

Example that sets individual keys of the row one at a time:

dispatch "SetDataOfIndex" to group "DataGrid" \
   with the dgHilitedIndex of group "DataGrid", "FirstName", "New First Name"
dispatch "SetDataOfIndex" to group "DataGrid" \
   with the dgHilitedIndex of group "DataGrid", "LastName", "New Last Name"
dispatch "SetDataOfIndex" to group "DataGrid" \
   with the dgHilitedIndex of group "DataGrid", "Title", "New Title"
dispatch "RefreshIndex" to group "DataGrid" with the dgHilitedIndex of group "DataGrid"

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.