InsertRow – PB Docs 126

InsertRow method (DataWindows)

Description

Inserts a row in a DataWindow or DataStore. If any columns
have default values, the row is initialized with these values before
it is displayed.

Controls

DataWindow type

Method applies to

PowerBuilder

DataWindow control, DataWindowChild object, DataStore
object

Web

Client control, server component

Web ActiveX

DataWindow control, DataWindowChild object

Syntax

[PowerBuilder and Web DataWindow server component]

[Web DataWindow client control and Web ActiveX]

Argument

Description

dwcontrol

A reference to a DataWindow control,
DataStore, or child DataWindow.

row

A value identifying the row before which
you want to insert a row. To insert a row at the end, specify 0.

Return Values

Returns the number of the row that was added if it succeeds
and –1 if an error occurs.

If any argument’s value is null, in PowerBuilder
and JavaScript the method returns null. If there is no DataWindow
object assigned to the DataWindow control or DataStore, this method
returns –1.

Usage

InsertRow simply inserts the row without
changing the display or the current row. To scroll to the row and
make it the current row, call ScrollToRow. To
simply make it the current row, call SetRow.

A newly inserted row (with a status flag of New!) is not included
in the modified count until data is entered in the row (its status
flag becomes NewModified!).

Web DataWindow client control

Calling InsertRow causes the new status
of the data to be sent back to the server where the data is retrieved again
and the row is inserted. Then the page is reloaded.

If the DataWindow object has retrieval arguments, they must
be specified in the HTMLGen.SelfLinkArgs property. For more information,
see the HTMLGen.property,
the Retrieve method, and the DataWindow Programmers
Guide
.

All methods that reload the page perform an AcceptText before
sending data back to the server. If the method fails (returns –1),
this means that pending data changes were not accepted and nothing
was sent back to the server. In this situation the ItemError event
occurs.

Examples

This statement inserts an initialized row before
row 7 in dw_Employee:

This example inserts an initialized row after the
last row in dw_employee, then scrolls to the row, which
makes it current:

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x