<layer>

One or more <layer> elements can be specified within a <widget class_="grid">. Each <layer> contains a 1010data query and can be used to provide data to it.

Description

The <layer> element cellcontextmenu can be specified within <widget class_="grid">. The layer contains a query that returns a table with two columns. The first column specifies the name of a <do onsubmit> clause to execute when the item is selected from the menu. The second column provides the label to display for each menu item. You can use the pipe (|) character between labels to indicate a menu hierarchy. The label column can also make use of the special sequences selector_, value_, or na_. These special sequences replace label text at runtime as follows:

selector_
selector_ is replaced with the name of the selected column at runtime.
value_
value_ is replaced with the value of the selected cell at runtime.
na_
na_ is replaced with the text "N/A" at runtime.

Syntax

<dynamic>
    <widget class_="grid">
      <layer name _="cellcontextmenu">
        [1010data_QUERY]
      </layer>
    </widget>
</dynamic>

Example: Customized right-click context menu

The following example shows how to create a custom context menu within the grid widget. The query within the cellcontextmenu layer produces a table containing columns named submit and label. submit specifies the name of a <do onsubmit> clause to invoke when the item is selected. label provides the label to display for each menu item. The end result shows that in addition to Copy and View this row in single-row mode, the grid context menu contains Select where and Select rows. Select where contains the submenus XX has the value XX and XX is N/A. Select rows contains the submenu Before this one. The selector_ and value_ special sequences are used to customize the context menu with the name of the column and the value of the cell.
<dynamic cmv="" cms="" cmi="" q="<sel value=&quot;1&quot;/>">
<layout arrange_="v">
<widget class_="grid" rowcopylimit_="1000" colcopylimit_="1000" 
   tablecopylimit_="1000" indexvalue_="@cmi" cellmenuvalue_="@cmv" cellmenuselector_="@cms">
   <base table="default.test.solar"/>
   <issue xml_="{@q}"/>    
   <layer name="cellcontextmenu" >
     <table cols="submit,label">
       selequal ,Select where...|selector_ has the value value_
       selisna  ,Select where...|selector_ is na_
       selbefore,Select rows...|Before this one
     </table>
   </layer>
</widget>
<widget class_="textbox" mode_="xml" xmlvalue_="@q"/>
</layout>

<do onsubmit_="selequal">
  <set>
  <q>
   <sel value="{@cms}='{@cmv}'"/>
  </q>
  </set>
</do>
<do onsubmit_="selisna">
<set>
  <q>
    <sel value="{@cms}=NA"/>
  </q>
</set>
</do>
<do onsubmit_="selbefore">
  <set>
  <q>
    <sel value="i_<={@cmi}"/>
  </q>
  </set>
</do>
</dynamic>