thyGrid

This is the Grid Element, the holder of cells.

CSS Classes

  • .thyGrid
  • .thyGrid_label
  • .thyGrid_contents
  • .thyGrid_row
  • .thyGrid_row<n>
  • .thyGrid_cell - look at thyGridCell as all that extra classes are also inherited
  • .thyGrid_col_header
  • .thyGrid_col
  • .thyGrid_col<n> - this is for defining column size
  • .<object name>
  • .<object name>_label
  • .<object name>_contents
  • .<object name>_row
  • .<object name>_row<n>
  • .<object name>_cell
  • .<object name>_col_header
  • .<object name>_col
  • .<object name>_col<n> - this is for defining column size

Events

selectrowhappens in the moment a row is selected
unselectrowhappens in the moment a row is unselected

See Also

thyGridCell

<thyCellCollection>

thyPanel

Parameters

nameThe name of the widget
labelThe label of the widget
Summary
This is the Grid Element, the holder of cells.
Removes every cell of the grid, including columns
Removes all grid rows
Inserts a new column into the grid.
Inserts a new column in the next available position.
Moves a whole column from one position to another
Returns a thyCollection of all specified column contents
Returns a thyCollection composed of other thyCollections, each one with the contents of a selected column.
Returns the number of columns this grid has
Removes a column from Grid.
Removes all columns of the grid.
Searches for a specified string in the specified column
Inserts a Row on the specified position (or at the end, if no index specified
Inserts a row at the end of the grid.
Move a Row from one position to another and refreshes CSS Classes
Returns a thyCollection of all specified row contents
Returns the thyGridRow element that is in the specified position
Returns a thyCollection with the selected row indexes
Returns a thyCollection composed of other thyCollections, each one with the contents of a selected row.
Returns the number of rows in Grid
Return a thyCollection with other thyCollections containing the elements of the entire thyGrid
Removes all rows from Grid
Remove all selected Rows from Grid
Remove specified row from Grid and re-index rows
Always selects a row instead of just a cell.
Returns the contents of a specified Cell
Returns a thyCollection with the contents of the selected cells
Returns the thyGridCell element that resides on the specified location
Change the contents of a specified cell.
Returns the DOM object that holds children DOM objects
Overwritten method that adds the specified class to main, rows and cells
Overwritten method that removes the specified class from main, rows and cells
Add all classes that were appended to thyGrid to a Row
Adds all classes that were appended to thyGrid to the cells of a row with their correct values
Removes all classes that were appended to thyGrid from a Row
Removes all classes that were appended to thyGrid from all Cells of a Row
Updates Row name to reflect its actual position
Clear up the thyGrid and inserts new specified contents
Return all the contents of a grid

cleanUp

p.cleanUp = function ()

Removes every cell of the grid, including columns

reset

p.reset = function ()

Removes all grid rows

Column Methods

insertColumn

p.insertColumn = function (title,
col,
index)

Inserts a new column into the grid.  This method (or appendColumn) can must be called before any other to initialize the grid.

Parameters

titleThe column title text
colThe thyCollection of column contents.  If this is the first inserted column, the collection can have any number of elements.  If this is not the first, the number will be shrinked/grown to reflect the actual number of rows.  This argument is optional.
indexThe position this column must occupy.  This argument is optional

appendColumn

p.appendColumn = function (title,
col)

Inserts a new column in the next available position.

Parameters

titleThe column title text
colThe thyCollection of column contents.  If this is the first inserted column, the collection can have any number of elements.  If this is not the first, the number will be shrinked/grown to reflect the actual number of rows.  This argument is optional.

moveColumn

p.moveColumn = function (fromIndex,
toIndex)

Moves a whole column from one position to another

Parameters

fromIndexOriginal Column position
toIndexDestination Column position

THIS METHOD IS NOT IMPLEMENTED YET!!!

getColumn

p.getColumn = function (index)

Returns a thyCollection of all specified column contents

Parameter

indexThe column position

getSelectedCols

Returns a thyCollection composed of other thyCollections, each one with the contents of a selected column.

THIS METHOD IS NOT IMPLEMENTED YET!!!

getColumnsCount

p.getColumnsCount = function ()

Returns the number of columns this grid has

removeColumn

p.removeColumn = function (index)

Removes a column from Grid.

Parameter

indexThe column position

removeAllColumns

p.removeAllColumns = function ()

Removes all columns of the grid.  This is actually the same as turning the grid into its initial state.

searchColumn

p.searchColumn = function (str,
col)

Searches for a specified string in the specified column

Parameters

strThe string to be searched for
colThe column index

Returns

The row index

Row Methods

insertRow

p.insertRow = function (row,
index)

Inserts a Row on the specified position (or at the end, if no index specified

Parameters

rowA thyCollection of row contents, indexed by column index
indexThe position where this row should be inserted

appendRow

p.appendRow = function (row)

Inserts a row at the end of the grid.

Paramenter

rowA thyCollection of the Row contents, indexed by column index

moveRow

p.moveRow = function (fromIndex,
toIndex)

Move a Row from one position to another and refreshes CSS Classes

Parameters

fromIndexOriginal Row position
toIndexDestination Row position

getRow

p.getRow = function (index)

Returns a thyCollection of all specified row contents

Parameter

indexThe row position

getRowElement

p.getRowElement = function (index)

Returns the thyGridRow element that is in the specified position

When what you want is just the contents, please use thyGrid::getRow.

This method should be used ONLY by other widgets that wants to have access to data only available through the thyGridRow object

Parameter

indexThe row position

getSelectedRowsIndexes

p.getSelectedRowsIndexes = function ()

Returns a thyCollection with the selected row indexes

getSelectedRows

p.getSelectedRows = function ()

Returns a thyCollection composed of other thyCollections, each one with the contents of a selected row.

getRowsCount

p.getRowsCount = function ()

Returns the number of rows in Grid

getAllRows

p.getAllRows = function ()

Return a thyCollection with other thyCollections containing the elements of the entire thyGrid

removeAllRows

p.removeAllRows = function ()

Removes all rows from Grid

removeSelectedRows

p.removeSelectedRows = function ()

Remove all selected Rows from Grid

removeRow

p.removeRow = function (index)

Remove specified row from Grid and re-index rows

Parameter

indexThe row index

setSelectCellSelectRow

p.setSelectCellSelectRow = function ()

Always selects a row instead of just a cell.

Cell Methods

getCell

p.getCell = function (rIndex,
cIndex)

Returns the contents of a specified Cell

Parameters

rIndexThe row index
cIndexThe col index

getSelectedCells

p.getSelectedCells = function ()

Returns a thyCollection with the contents of the selected cells

getCellElement

p.getCellElement = function (rIndex,
cIndex)

Returns the thyGridCell element that resides on the specified location

If what you want is just the contents of the thyGridCell element, please use thyGrid::getCell.

This method should be used ONLY when the user wants to manipulate any property of the cell element.

Parameters

rIndexThe row index
cIndexThe col index

changeCell

p.changeCell = function (content,
rIndex,
cIndex)

Change the contents of a specified cell.

Parameters

contentThe new Cell Content
rIndexThe row index
cIndexThe col index

Private Methods

_getDOMChildrenHolder

p._getDOMChildrenHolder = function ()

Returns the DOM object that holds children DOM objects

_addCSSClass

p._addCSSClass = function (cssClass)

Overwritten method that adds the specified class to main, rows and cells

Parameter

cssClassThe CSS Class to be added

_removeCSSClass

p._removeCSSClass = function (cssClass)

Overwritten method that removes the specified class from main, rows and cells

Parameter

cssClassThe CSS Class to be removed

_addRowClasses

p._addRowClasses = function (row,
rowIndex)

Add all classes that were appended to thyGrid to a Row

Parameters

rowThe thyGridRow element that will have the classes
rowIndexThe index of the row

_addRowCellsClasses

p._addRowCellsClasses = function (row)

Adds all classes that were appended to thyGrid to the cells of a row with their correct values

Parameters

rowThe thyGridRow element whose cells will have their classes set.

_removeRowClasses

p._removeRowClasses = function (row,
rowIndex)

Removes all classes that were appended to thyGrid from a Row

Parameters

rowThe thyGridRow element that will have its classes removed
rowIndexThe index of the Row

_removeRowCellsClasses

p._removeRowCellsClasses = function (row)

Removes all classes that were appended to thyGrid from all Cells of a Row

Parameter

rowThe thyGridRow element that will have its classes removed

_updateRowName

p._updateRowName = function (row,
rowIndex)

Updates Row name to reflect its actual position

Parameter

rowThe thyGridRow that must have its name updated
rowIndexThe position of the Row

_populateContents

p._populateContents = function (data)

Clear up the thyGrid and inserts new specified contents

Parameters

dataCan be of 2 types:
  • An array of arrays, each one with the contents of all cells of that row.
  • An object containing the columns or the rows or both

_sweepOutContents

p._sweepOutContents = function ()

Return all the contents of a grid

p.cleanUp = function ()
Removes every cell of the grid, including columns
p.reset = function ()
Removes all grid rows
p.insertColumn = function (title,
col,
index)
Inserts a new column into the grid.
p.appendColumn = function (title,
col)
Inserts a new column in the next available position.
p.moveColumn = function (fromIndex,
toIndex)
Moves a whole column from one position to another
p.getColumn = function (index)
Returns a thyCollection of all specified column contents
This is the basic ThyAPI Collection Element.
p.getColumnsCount = function ()
Returns the number of columns this grid has
p.removeColumn = function (index)
Removes a column from Grid.
p.removeAllColumns = function ()
Removes all columns of the grid.
p.searchColumn = function (str,
col)
Searches for a specified string in the specified column
p.insertRow = function (row,
index)
Inserts a Row on the specified position (or at the end, if no index specified
p.appendRow = function (row)
Inserts a row at the end of the grid.
p.moveRow = function (fromIndex,
toIndex)
Move a Row from one position to another and refreshes CSS Classes
p.getRow = function (index)
Returns a thyCollection of all specified row contents
p.getRowElement = function (index)
Returns the thyGridRow element that is in the specified position
This is the Grid Row class.
p.getSelectedRowsIndexes = function ()
Returns a thyCollection with the selected row indexes
p.getSelectedRows = function ()
Returns a thyCollection composed of other thyCollections, each one with the contents of a selected row.
p.getRowsCount = function ()
Returns the number of rows in Grid
p.getAllRows = function ()
Return a thyCollection with other thyCollections containing the elements of the entire thyGrid
This is the Grid Element, the holder of cells.
p.removeAllRows = function ()
Removes all rows from Grid
p.removeSelectedRows = function ()
Remove all selected Rows from Grid
p.removeRow = function (index)
Remove specified row from Grid and re-index rows
p.setSelectCellSelectRow = function ()
Always selects a row instead of just a cell.
p.getCell = function (rIndex,
cIndex)
Returns the contents of a specified Cell
p.getSelectedCells = function ()
Returns a thyCollection with the contents of the selected cells
p.getCellElement = function (rIndex,
cIndex)
Returns the thyGridCell element that resides on the specified location
This is the basic Cell element.
p.changeCell = function (content,
rIndex,
cIndex)
Change the contents of a specified cell.
p._getDOMChildrenHolder = function ()
Returns the DOM object that holds children DOM objects
p._addCSSClass = function (cssClass)
Overwritten method that adds the specified class to main, rows and cells
p._removeCSSClass = function (cssClass)
Overwritten method that removes the specified class from main, rows and cells
p._addRowClasses = function (row,
rowIndex)
Add all classes that were appended to thyGrid to a Row
p._addRowCellsClasses = function (row)
Adds all classes that were appended to thyGrid to the cells of a row with their correct values
p._removeRowClasses = function (row,
rowIndex)
Removes all classes that were appended to thyGrid from a Row
p._removeRowCellsClasses = function (row)
Removes all classes that were appended to thyGrid from all Cells of a Row
p._updateRowName = function (row,
rowIndex)
Updates Row name to reflect its actual position
p._populateContents = function (data)
Clear up the thyGrid and inserts new specified contents
p._sweepOutContents = function ()
Return all the contents of a grid
Base class for all other ThyAPI GUI Components