Skip to content

ShouldSaveSelectedRow - cCJGridDataSource

Returns True if the selected row has savable changes

Type: Function
Return Data Type: Boolean

Syntax

Function ShouldSaveSelectedRow Returns Boolean

Call Example

Get ShouldSaveSelectedRow to BooleanVariable

Description

ShouldSaveSelectedRow is called to determine if the SelectedRow should be saved. It is similar to IsSelectedRowChanged, but it allows the datasource object to determine what to do with a new row with no changes (save it or remove it). This determines how a grid will react to requests for saves, deletes and row changes. It is the datasource object's responsibility to determine if a row should be saved.

cCJGrid / cCJGridDataSource

With simple grids, you are allowed to save blank new rows. Therefore, ShouldSaveSelectedRow returns True if either IsSelectedRowChanged or IsSelectedRowNew is True. This means that if you add a new row and navigate away from it without making any changes, the row will be maintained. When you do this, you have "saved" an empty row in the grid. This makes perfect sense in regular grids.

cDbCJGrid / cDbCJGridDataSource

With DataDictionary-based grids, a row should only be saved if there are changes. If the row is new and unchanged, it cannot be saved. Therefore, ShouldSaveSelectedRow returns True if IsSelectedRowChanged is True. This means that if you add a new row and navigate away from it without making any changes, the new, unchanged row will be removed.

Return Value

True if the selected row has changes that can be saved, False if not.