News in versions: FastGrid 1.0, TreeGrid 17.0
FastGrid FastSheet ExamplesSamples DocumentationDoc Download Licensing Prices Buy Development
services
References References Contacts
TreeGrid Gantt chart SpreadSheet ExamplesSamples DocumentationDoc Download Licensing Prices Buy Contacts

4. Cell popup menus - List & Suggest

Combo boxes - choosing cell values from popup list

Source: 04-List.js
For more information see List.
  • Defining popup list


    The popup list can be defined by cell attribute

    List

    or

    ListMenu

    .
    • List


      List affects the value in the cell. The Cell value contain(s) the List key(s) and shows the List value(s).
      List can set also other text attributes like TextColor with the individual items.
      List can be defined by three ways:
      • As first character separated string or array. In this case the keys are the values themselves. Or their indexes if set

        IndexList

        .
      • By object with key / value pairs.
      • By object with key / object pairs, where the object contains attribute Value for the cell value and optionally Text for menu text and / or Suggest for suggest menu text and text attributes like TextColor to be applied to cell text.
    • ListMenu


      ListMenu does not affect the cell value, it just defines the popup menu and can set only cell value, not any other attribute.
      It can be used to define the list instead of the List attribute or to change the popup menu setting showing the list defined by List or by the ListMenu.
      ListMenu can be defined in three ways:
      • As first character separated string or array as simple menu defition with only values.
      • Array of objects, where the object contains attribute Value for the cell value and optionally Text for menu text and / or Suggest for suggest menu text and / or other attributes affecting the menu item display.
      • Full FastGrid menu definition with Script tag.
      ListMenu can be downloaded also from server on demand by setting Cfg or cell attribute

      ListMenuUrl

      . It can be loaded once or on every show by setting

      ListMenuReload

      attribute.
  • Showing popup list


    The popup list can be shown by:
    • adding "List" to icons in

      LeftIcons

      /

      RightIcons

      /

      TextIcons

      or toolbar cell

      Icon

      .
    • on toolbar setting

      D

      to "List" or "ListSmall".
    • adding the "List" to cell attribute

      Button

      .
    • assigning action

      ShowList

      to some event (e.g. Actions: { OnRightClick:"ShowList()" }.
    • calling API method

      ShowList

      .
    • setting cell attribute

      Suggest

      .
    The cell with list can be visually marked by inner border set by

    CellBorder

    . On toolbar it is already set by D:"List".
  • Related popup lists


    The List and / or ListMenu can be related to another cell value, usually also with List / ListMenu, to use specific list according the value in the related cell.
    There can be more related cells in the chain. In the sample there are three related cells in LIST1 / LIST2 / LIST3 columns. LIST2 is related to LIST1 and LIST3 is related to LIST2 (and to LIST1).
    The related cell is set by attribute

    ListRelated

    containing column to id to refer another cell in the same row or it can contain row and column ids to refer another cell.
    If the cell is related to more cells, their ids are listed all, comma separated, starting by the most distant one in the chain.
    After change of the related cell, the next cells in related chain should be cleared using

    ClearCells

    attribute, its format is the same as ListRelated.
  • Not existing items in popup list


    If the cell contains value not included in the List, it is normally shown or there can be shown

    NoListValue

    if defined.
    The cell with popup list is still editable, to restrict editing and show the list always set

    Button

    = "List.
    To restrict entering not existing values or enter case sensitive or without white space set

    ListEdit

    to appropriate value.
  • Suggest items in popup list during editing


    To show popup list with suggested items for entered text set

    Suggest

    attribute, it also controls when the suggest list is shown.
    The suggest list shows subset of

    List

    or

    SuggestMenu

    items that pass search settings set by

    SuggestSearch

    and

    SuggestType

    attributes for actually entered text. The suggest list is updated whenever the entered text changes during editing.
    It is possible to show suggest list only for part of the entered text, separated by

    SuggestSeparator

    character, often set to ";" like for Range cells.
    SuggestMenu can be downloaded also from server on demand by setting Cfg or cell attribute

    SuggestMenuUrl

    . The server can return full suggest menu once or can return different suggest menu per edited value, according to

    SuggestMenuReload

    attribute.
    There are various other attributes for Suggest, see Suggest.