class_="editgrid" (deprecated)

Using <widget class_="editgrid"> creates a table whose cells can be edited in the browser.

Note: The number of rows multiplied by the number of columns must be less than 100,000.

Syntax

<dynamic var="">
    <widget class_="editgrid" label_="[RESULT_TABLE_NAME]" 
     value_="@var">
        [1010data_QUERY]
    </widget>
</dynamic>

The [1010data_QUERY] may be specified between the opening and closing tags of the <widget>. The results of the query provide data for the <widget> to display.

Attributes

label_
Accepts text that is used as a label for the widget.
labelpos_
Accepts a string that specifies the position of the label for the widget.

Valid values are:

  • left
  • right
  • top
  • bottom

The default is left.

labelwidth_
Accepts an integer that specifies the width of the label for the widget.

If the length of the string specified by the label_ attribute is greater than the value specified for labelwidth_, the text will wrap over multiple lines.

If the labelwidth_ attribute is not specified, the default width is the length of the string specified by the label_ attribute.

readonly_
Accepts a 1 to enable. Makes the grid read-only. Default is 0.
rocols_
Accepts a comma-separated list of column names in the table. Columns whose names were passed to rocols_ will be read-only.
resetbut_
Accepts a 0 to deactivate. Default is 1. When active, displays a Reset button that will revert the editable grid back to its state at the time theit was originally rendered.
clearbut_
Accepts a 0 to deactive. Default is 1. When active, displays a Clear button that clears all the rows in the editable grid.
savebut_
Accepts a 0 to deactivate. Default is 1. When active, displays a Save button that allows the end-user to upload and save changes to the grid to a temporary table.
value_
Accepts the name of a variable defined in the opening <dynamic> tag of the QuickApp. When the Save button is clicked by an end-user, the path to the temporary table where the data is saved will be stored in the variable passed to value_.
sparerow_
Accepts a 0 to deactive. Default is 1. Specifies whether to start a new empty row in the grid. The empty row is now uploaded when the grid is saved.
dragfill_
Accepts a 0 to deactive. Default is 1. Specifies whether to allow the user to drag to "fill" (highlight) a range of cells in the editable grid.
restrict_
Accepts a 0 to deactivate. Default is 1. Specifies whether to prohibit the end-user from entering invalid values in the grid when editing. Default behavior will restrict the user and prevent invalid values from being entered.
headers_
Specifies what to use as the column headers. Accepts the following values:
labels
Default. Uses column labels.
names
Uses the column names.
none
Does not display headers.
rownums_
Accepts a 0 to deactivate. 1 is the default. When active, displays a row number next to each row in the grid.
synch_
Accepts a 1 to activate. Default is 0. When active, specifies that any time the grid is changed the updates will be saved to the temporary table.
moreopts_
Accepts a 1 to activate. Default is 0. When active, provides extra options in the context menu accessed by right-clicking on the grid.

(Available as of prod-9)

Example: Basic implementation

<dynamic var="">
  <layout>
    <widget class_="editgrid" base_="pub.demo.retail.item" savebut_="0"
     width_="900" value_="@var"/>
    <widget class_="text" text_="Saved at:  {@var}"/>
  </layout>
</dynamic>

Example: User-defined data

<dynamic savepath="">
    <layout>
        <widget class_="editgrid" base_="pub.demo.weather.hourly90" 
         margin_="10" width_="480" height_="260" label_="U.S. Auto Sales" 
         readonly_="0" rocols_="year" resetbut_="1" clearbut_="1" 
         savebut_="1" sparerow_="1" dragfill_="1" restrict_="0" 
         headers_="label" rownums_="1" stretch_="hybrid" synch_="0" 
         minrows_="10" maxrows_="20" constrows_="0" value_="@savepath">
            <meta>empty
            </meta>
            <table cols="year,gm,ford,cry" labels="Year,Gm,Ford,Cry">
             1992,100,98,75;            
             1993,103,102,80;
             1994,106,103,82;
             1995,99,100,81;
             1996,101,100,87;
             1997,107,103,86;
             1998,110,105,85;
            </table>
        </widget>
    </layout>
</dynamic>