APIs

Show:

View for tabular data. Avoid accessing properties of the grid directly. Instead, use the provided methods or add methods as you see fit. Try and make use of the columns option or attributeProps in the model of the collection. The grid will pull the name and the display method from the model if you give the id.

Events: "rowclick" - Fires when a user clicks on a grid row. Params: The data for that row. "rowdblclick" - Fires when a user double clicks on a grid row. Params: The data for that row. "page" - Fires when a user changes the grid page. Params: The new page number. "rendered" - Fires when the grid is finished rendering "action" - Fires when a user defined action is triggered

To listen for an event, just do the following with your grid object: grid.bind("rowclick", myobj.onRowClick, myobj)

The Grid also exposes an Autocomplete object: grid.autocomplete

// bare minimum
new awa.ui.CollectionGrid({
    collection: new awa.mvc.Collection([], {model: ExampleModel}),
    columns: [
        {id: "exa_id"},
        {id: "exa_string"},
        {id: "exa_text"},
        {id: "exa_ssn"}
    ]
});

Constructor

awa.ui.CollectionGrid

(
  • options
)

Parameters:

  • options Object
    • collection Collection

      Required Collection for the grid to use. Be careful with using shared collections as this view will try and control the collection on occasion.

    • [columns] awa.ui.CollectionGrid.Column optional

      an array of objects that outline the columns for the grid.

    • [itemsPerPage] Integer optional
    • [page] Integer optional
    • [prefetch] Boolean optional
    • [rowclick] Function optional

      passed the model that represents data for the row

    • [syncOnRowSubmit] Boolean optional

      defaults to true

    • [panels] ? optional
    • [title_bar] Boolean optional
    • [footer_bar] Boolean optional
    • [table_header] Boolean optional
    • [items_per_page_input] Integer optional
    • [customRowClassNewArgs] Boolean optional

      customRowClass function now receives an args object with the json property and a model property

    • [customRowClass] Function optional
    • [onCollectionInconsistency] Function optional

      allows you to catch errors such as duplicate rows

    • [scope] String optional

      Scoping for model forms

    • [multiselect] Boolean optional

      For checkmark greatness simple multiselect grid with no controls within grid to save choices

    • [persistent_multiselect] Boolean optional

      (defaults false) multiselect grid which shows dynamically growing or shrinking list at bottom with controls to save multiple choices to a previously defined collection, i.e. icd9s or cpts

    • [bookmark] Boolean optional

      For bookmark greatness. Use at your own risk.

    • [noResultsDisplay] String optional
    • [hideOnEmpty] Boolean optional

      Hides when no results are found. CAUTION, will show element automatically when results are found.

    • [showTotalRowCountOption] Boolean optional

      Defaults to true, allows user to include total row count

    • [searchable] Boolean optional

      Allows for grid searching. Use instead of Autoselect

    • [autoFocus] Boolean optional

      If options.searchable and this is enabled, the search box will receive focus on render

    • [initialRowFocus] Boolean optional

      Sets the row to focus on initialization; Negative value for none

Methods

buildMultiSelectDynamicList

() Undefined

build the Persisted multiselect list. Internal use only

Returns:

Undefined:

checkByModelID

(
  • ids
  • options
)
Array

Parameters:

  • ids Array

    Array model ids to check

  • options Object

    Object parameter bag

Returns:

Array:

Array of currently selected models models

checkByRowIDs

(
  • ids
  • options
)
Array

Parameters:

  • ids Array

    Array row ids to check

  • options Object

    Object parameter bag

Returns:

Array:

Array of currently selected models models

customRowClassModelFunction

(
  • args
)
String

generic custom row class to be used with collection grids

Parameters:

  • args Object

    Arguments passed on call

Returns:

String:

css class for the grid row

generateDisableButtonConfig

(
  • config
)
Object

Parameters:

  • config Object

    Configuration

Returns:

Object:

Configuration for default disable button

generateEditButtonConfig

(
  • config
)
Object

Parameters:

  • config Object

    Configuration

    • ModelClass Constructor

      constructor for model

Returns:

Object:

Configuration for default edit button

generateEnableButtonConfig

(
  • config
)
Object

Parameters:

  • config Object

    Configuration

Returns:

Object:

Configuration for default enable button

getFieldByID

(
  • id
  • col_id
)
jquery.Selector

Parameters:

  • id String | Integer

    Model id

  • col_id String | Integer

    attribute key on column

Returns:

jquery.Selector:

field

getFieldByRow

(
  • row_id
  • col_id
)
jquery.Selector

Parameters:

  • row_id String | Integer

    Row id

  • col_id String | Integer

    attribute key on column

Returns:

jquery.Selector:

field

getRowElement

(
  • id
)
jquery.Selector

Parameters:

  • id String | Integer

    id of Model

Returns:

jquery.Selector:

row

getSelected

() Array

Returns:

Array:

Array of currently selected models models

getSelectedIds

() Array

Returns:

Array:

Array of Model ids

getSelectedModels

() Array

Returns:

Array:

Array of models

hideColumn

(
  • colID
)
Undefined

Hides a field for all rows in the grid

Parameters:

  • colID String

    Column id attribute

Returns:

Undefined:

initRowEdit

(
  • args
)
Undefined

Starts singular row edit on grid

Parameters:

  • args Object

    Options

    • row_id String | Integer

      Row id to start edit mode

Returns:

Undefined:

isColumnVisible

(
  • colID
)
Boolean

Parameters:

  • colID String

    Column id attribute

Returns:

Boolean:

Indicates if column is visible

resetPersistentSelectedCollection

() Undefined

Clears currently selected items

Returns:

Undefined:

showColumn

(
  • colID
)
Undefined

Shows a field for all rows in the grid

Parameters:

  • colID String

    Column id attribute

Returns:

Undefined:

showPage

(
  • page
  • [callback]
  • [fetch]
)
awa.ui.CollectionGrid

Have the grid display the page requested.

Parameters:

  • page Integer

    The page number to be displayed.

  • [callback] Function optional

    callback Function to be called when rendering of the page is complete

  • [fetch] Boolean optional

    Indicates if collection should fetch or use existing data

Returns: