Fork me on GitHub
Class Index | File Index

Classes


Class EditableGrid

EditableGrid
Defined in: <editablegrid-2.0.js>.

Class Summary
Constructor Attributes Constructor Name and Description
 
EditableGrid(name, config)
Creates a new EditableGrid.
Field Summary
Field Attributes Field Name and Description
 
Default properties
Method Summary
Method Attributes Method Name and Description
 
addCellValidator(columnIndexOrName, cellValidator)
Adds a cell validator for the specified column index
 
addDefaultCellValidators(columnIndexOrName)
Adds default cell validators for the specified column index (according to the column type)
 
addRow(rowId, columns, dontSort, dontSort)
Append row with given id and data Deprecated: use appendRow instead
 
append(rowId, columns, dontSort, dontSort)
Append row with given id and data
 
attachToHTMLTable(_table, _columns)
Attach to an existing HTML table.
 
Returns true if we are not already on the first page
 
Returns true if we are not already on the last page
 
clearCellValidators(columnIndexOrName)
Clear all cell validators for the specified column index
 
clearChart(divId)
clearChart
 
filter(filterString)
Filter the content of the table
 
Go the first page if we are not already on the first page
 
getCell(rowIndex, columnIndex)
Get cell element at given row and column
 
getColumn(columnIndexOrName)
Returns the column
 
Returns the number of columns
 
getColumnIndex(columnIndexOrName)
Find column index from its name
 
getColumnLabel(columnIndexOrName)
Returns the label of a column
 
getColumnName(columnIndexOrName)
Returns the name of a column
 
getColumnPrecision(columnIndexOrName)
Returns the precision of a column
 
getColumnType(columnIndexOrName)
Returns the type of a column
 
getColumnUnit(columnIndexOrName)
Returns the unit of a column
 
Returns the number of pages according to the current page size
 
getDisplayValueAt(rowIndex, columnIndex)
Returns the display value (used for sorting and filtering) at the specified index
 
Returns the number of pages according to the current page size
 
getPagesInInterval(interval, callback)
Returns an array of page indices in the given interval.
 
getRow(index)
Get HTML row object at given index
 
getRowAttribute(index, name)
Get custom row attribute specified in XML
 
Returns the number of rows
 
getRowId(index)
Get row id for given row index
 
getRowIndex(rowId)
Get index of row (in filtered data) with given id
 
getRowValues(rowIndex)
Return an associative array (column name => value) of values in row with given index
 
getSlidingPageInterval(slidingWindowSize)
Returns an interval { startPageIndex: .
 
getValueAt(rowIndex, columnIndex)
Returns the value at the specified index
 
hasColumn(columnIndexOrName)
Returns true if the column exists
 
insert(rowIndex, rowId, columns, dontSort, dontSort)
Insert row with given id and data before given row index
 
insertAfter(rowIndex, rowId, columns, dontSort, dontSort)
Insert row with given id and data after given row index
 
isColumnBar(columnIndexOrName)
Returns true if the column is to be displayed in a bar chart
 
isColumnNumerical(columnIndexOrName)
Returns true if the column is numerical (double or integer)
 
isSame(v1, v2)
Detect is 2 values are exactly the same (type and value).
 
Go the last page if we are not already on the last page
 
load(object)
Load metadata and/or data from a Javascript object No callback "tableLoaded" is called since this is a synchronous operation.
 
loadJSON(url)
Load metadata and/or data from a JSON url The callback "tableLoaded" is called when loading is complete.
 
Load metadata and/or data from a JSON string No callback "tableLoaded" is called since this is a synchronous operation.
 
loadXML(url)
Load metadata and/or data from an XML url The callback "tableLoaded" is called when loading is complete.
 
Load metadata and/or data from an XML string No callback "tableLoaded" is called since this is a synchronous operation.
 
Go the next page if we are not already on the last page
 
Go the previous page if we are not already on the first page
 
Refreshes the grid
 
remove(rowIndex)
Remove row at given index
 
removeRow(rowId)
Remove row with given id Deprecated: use remove(rowIndex) instead
 
renderBarChart(divId, title, labelColumnIndexOrName, options:)
renderBarChart Render open flash bar chart for the data contained in the table model
 
renderGrid(containerid, className, tableid)
Renders the grid as an HTML table in the document
 
renderPieChart(divId, title, valueColumnIndexOrName, labelColumnIndexOrName:, options:)
renderPieChart
 
renderStackedBarChart(divId, title, labelColumnIndexOrName, options:)
renderStackedBarChart Render open flash stacked bar chart for the data contained in the table model
 
setCaption(columnIndexOrName, caption)
Sets the table caption: set as null to remove
 
setCellEditor(columnIndexOrName, cellEditor)
Sets the cell editor for the specified column index
 
setCellRenderer(columnIndexOrName, cellRenderer)
Sets the cell renderer for the specified column index
 
setEnumProvider(columnIndexOrName, enumProvider)
Sets the enum provider for the specified column index
 
setHeaderEditor(columnIndexOrName, cellEditor)
Sets the header cell editor for the specified column index
 
setHeaderRenderer(columnIndexOrName, cellRenderer)
Sets the column header cell renderer for the specified column index
 
setPageIndex(pageIndex)
Sets the current page (no effect if pageSize is 0)
 
setPageSize(pageSize)
Sets the page size(pageSize of 0 means no pagination)
 
setRowAttribute(index, name, value)
Set custom row attribute
 
setValueAt(rowIndex, columnIndex, value, render)
Sets the value at the specified index
 
sort(columnIndexOrName, descending, backOnFirstPage)
Sort on a column
 
Callback functions
 
updateChart(divId, chart)
updateChart
Class Detail
EditableGrid(name, config)
Creates a new EditableGrid.

You can specify here some configuration options (optional).
You can also set these same configuration options afterwards.

These options are:

  • enableSort: enable sorting when clicking on column headers (default=true)
  • doubleclick: use double click to edit cells (default=false)
  • editmode: can be one of
    • absolute: cell editor comes over the cell (default)
    • static: cell editor comes inside the cell
    • fixed: cell editor comes in an external div
  • editorzoneid: used only when editmode is set to fixed, it is the id of the div to use for cell editors
  • allowSimultaneousEdition: tells if several cells can be edited at the same time (default=false)
    Warning: on some Linux browsers (eg. Epiphany), a blur event is sent when the user clicks on a 'select' input to expand it. So practically, in these browsers you should set allowSimultaneousEdition to true if you want to use columns with option values and/or enum providers. This also used to happen in older versions of Google Chrome Linux but it has been fixed, so upgrade if needed.
  • saveOnBlur: should be cells saved when clicking elsewhere ? (default=true)
  • invalidClassName: CSS class to apply to text fields when the entered value is invalid (default="invalid")
  • ignoreLastRow: ignore last row when sorting and charting the data (typically for a 'total' row)
  • caption: text to use as the grid's caption
  • dateFormat: EU or US (default="EU")
  • shortMonthNames: list of month names (default=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"])
  • smartColorsBar: colors used for rendering (stacked) bar charts
  • smartColorsPie: colors used for rendering pie charts
  • pageSize: maximum number of rows displayed (0 means we don't want any pagination, which is the default)
Parameters:
name
config
Field Detail
enableSort
Default properties
Method Detail
addCellValidator(columnIndexOrName, cellValidator)
Adds a cell validator for the specified column index
Parameters:
{Object} columnIndexOrName
index or name of the column
{CellValidator} cellValidator

addDefaultCellValidators(columnIndexOrName)
Adds default cell validators for the specified column index (according to the column type)
Parameters:
{Object} columnIndexOrName
index or name of the column

addRow(rowId, columns, dontSort, dontSort)
Append row with given id and data Deprecated: use appendRow instead
Parameters:
{Integer} rowId
id of new row
{Integer} columns
{Boolean} dontSort
dontSort

append(rowId, columns, dontSort, dontSort)
Append row with given id and data
Parameters:
{Integer} rowId
id of new row
{Integer} columns
{Boolean} dontSort
dontSort

attachToHTMLTable(_table, _columns)
Attach to an existing HTML table. The second parameter can be used to give the column definitions. This parameter is left for compatibility, but is deprecated: you should now use "load" to setup the metadata.
Parameters:
_table
_columns

canGoBack()
Returns true if we are not already on the first page
Returns:

canGoForward()
Returns true if we are not already on the last page
Returns:

clearCellValidators(columnIndexOrName)
Clear all cell validators for the specified column index
Parameters:
{Object} columnIndexOrName
index or name of the column

clearChart(divId)
clearChart
Parameters:
divId
Returns:

filter(filterString)
Filter the content of the table
Parameters:
{String} filterString
String string used to filter: all words must be found in the row

firstPage()
Go the first page if we are not already on the first page
Returns:

getCell(rowIndex, columnIndex)
Get cell element at given row and column
Parameters:
rowIndex
columnIndex

getColumn(columnIndexOrName)
Returns the column
Parameters:
{Object} columnIndexOrName
index or name of the column

getColumnCount()
Returns the number of columns

getColumnIndex(columnIndexOrName)
Find column index from its name
Parameters:
{Object} columnIndexOrName
index or name of the column

getColumnLabel(columnIndexOrName)
Returns the label of a column
Parameters:
{Object} columnIndexOrName
index or name of the column

getColumnName(columnIndexOrName)
Returns the name of a column
Parameters:
{Object} columnIndexOrName
index or name of the column

getColumnPrecision(columnIndexOrName)
Returns the precision of a column
Parameters:
{Object} columnIndexOrName
index or name of the column

getColumnType(columnIndexOrName)
Returns the type of a column
Parameters:
{Object} columnIndexOrName
index or name of the column

getColumnUnit(columnIndexOrName)
Returns the unit of a column
Parameters:
{Object} columnIndexOrName
index or name of the column

getCurrentPageIndex()
Returns the number of pages according to the current page size

getDisplayValueAt(rowIndex, columnIndex)
Returns the display value (used for sorting and filtering) at the specified index
Parameters:
{Integer} rowIndex
{Integer} columnIndex

getPageCount()
Returns the number of pages according to the current page size

getPagesInInterval(interval, callback)
Returns an array of page indices in the given interval.
Parameters:
interval
The given interval must be an object with properties 'startPageIndex' and 'endPageIndex'. This interval may for example have been obtained with getCurrentPageInterval.
callback
The given callback is applied to each page index before adding it to the result array. This callback is optional: if none given, the page index will be added as is to the array. If given , the callback will be called with two parameters: pageIndex (integer) and isCurrent (boolean).
Returns:

getRow(index)
Get HTML row object at given index
Parameters:
{Integer} index
of the row

getRowAttribute(index, name)
Get custom row attribute specified in XML
Parameters:
{Integer} index
of the row
{String} name
of the attribute

getRowCount()
Returns the number of rows

getRowId(index)
Get row id for given row index
Parameters:
{Integer} index
of the row

getRowIndex(rowId)
Get index of row (in filtered data) with given id
Parameters:
{Integer} rowId
or HTML row object

getRowValues(rowIndex)
Return an associative array (column name => value) of values in row with given index
Parameters:
{Integer} rowIndex

getSlidingPageInterval(slidingWindowSize)
Returns an interval { startPageIndex: ..., endPageIndex: ... } so that a window of the given size is visible around the current page (hence the 'sliding'). If pagination is not enabled this method displays an alert and returns null. If pagination is enabled but there is only one page this function returns null (wihtout error).
Parameters:
slidingWindowSize
size of the visible window
Returns:

getValueAt(rowIndex, columnIndex)
Returns the value at the specified index
Parameters:
{Integer} rowIndex
{Integer} columnIndex

hasColumn(columnIndexOrName)
Returns true if the column exists
Parameters:
{Object} columnIndexOrName
index or name of the column

insert(rowIndex, rowId, columns, dontSort, dontSort)
Insert row with given id and data before given row index
Parameters:
{Integer} rowIndex
index of row before which to insert new row
{Integer} rowId
id of new row
{Integer} columns
{Boolean} dontSort
dontSort

insertAfter(rowIndex, rowId, columns, dontSort, dontSort)
Insert row with given id and data after given row index
Parameters:
{Integer} rowIndex
index of row after which to insert new row
{Integer} rowId
id of new row
{Integer} columns
{Boolean} dontSort
dontSort

isColumnBar(columnIndexOrName)
Returns true if the column is to be displayed in a bar chart
Parameters:
{Object} columnIndexOrName
index or name of the column

isColumnNumerical(columnIndexOrName)
Returns true if the column is numerical (double or integer)
Parameters:
{Object} columnIndexOrName
index or name of the column

isSame(v1, v2)
Detect is 2 values are exactly the same (type and value). Numeric NaN are considered the same.
Parameters:
v1
v2
Returns:
boolean

lastPage()
Go the last page if we are not already on the last page
Returns:

load(object)
Load metadata and/or data from a Javascript object No callback "tableLoaded" is called since this is a synchronous operation.
Parameters:
object

loadJSON(url)
Load metadata and/or data from a JSON url The callback "tableLoaded" is called when loading is complete.
Parameters:
url

loadJSONFromString(json)
Load metadata and/or data from a JSON string No callback "tableLoaded" is called since this is a synchronous operation.
Parameters:
json

loadXML(url)
Load metadata and/or data from an XML url The callback "tableLoaded" is called when loading is complete.
Parameters:
url

loadXMLFromString(xml)
Load metadata and/or data from an XML string No callback "tableLoaded" is called since this is a synchronous operation. Contributed by Tim Consolazio of Tcoz Tech Services, tcoz@tcoz.com http://tcoztechwire.blogspot.com/2012/04/setxmlfromstring-extension-for.html
Parameters:
xml

nextPage()
Go the next page if we are not already on the last page
Returns:

prevPage()
Go the previous page if we are not already on the first page
Returns:

refreshGrid()
Refreshes the grid
Returns:

remove(rowIndex)
Remove row at given index
Parameters:
{Integer} rowIndex

removeRow(rowId)
Remove row with given id Deprecated: use remove(rowIndex) instead
Parameters:
{Integer} rowId

renderBarChart(divId, title, labelColumnIndexOrName, options:)
renderBarChart Render open flash bar chart for the data contained in the table model
Parameters:
divId
title
labelColumnIndexOrName
options:
legend (label of labelColumnIndexOrName), bgColor (#ffffff), alpha (0.9), limit (0), bar3d (true), rotateXLabels (0)
Returns:

renderGrid(containerid, className, tableid)
Renders the grid as an HTML table in the document
Parameters:
{String} containerid
id of the div in which you wish to render the HTML table (this parameter is ignored if you used attachToHTMLTable)
{String} className
CSS class name to be applied to the table (this parameter is ignored if you used attachToHTMLTable)
{String} tableid
ID to give to the table (this parameter is ignored if you used attachToHTMLTable)
See:
EditableGrid#attachToHTMLTable
EditableGrid#loadXML

renderPieChart(divId, title, valueColumnIndexOrName, labelColumnIndexOrName:, options:)
renderPieChart
Parameters:
divId
title
valueColumnIndexOrName
labelColumnIndexOrName:
if same as valueColumnIndexOrName, the chart will display the frequency of values in this column
options:
startAngle (0), bgColor (#ffffff), alpha (0.5), limit (0), gradientFill (true)
Returns:

renderStackedBarChart(divId, title, labelColumnIndexOrName, options:)
renderStackedBarChart Render open flash stacked bar chart for the data contained in the table model
Parameters:
divId
title
labelColumnIndexOrName
options:
legend (label of labelColumnIndexOrName), bgColor (#ffffff), alpha (0.8), limit (0), rotateXLabels (0)
Returns:

setCaption(columnIndexOrName, caption)
Sets the table caption: set as null to remove
Parameters:
columnIndexOrName
caption
Returns:

setCellEditor(columnIndexOrName, cellEditor)
Sets the cell editor for the specified column index
Parameters:
{Object} columnIndexOrName
index or name of the column
{CellEditor} cellEditor

setCellRenderer(columnIndexOrName, cellRenderer)
Sets the cell renderer for the specified column index
Parameters:
{Object} columnIndexOrName
index or name of the column
{CellRenderer} cellRenderer

setEnumProvider(columnIndexOrName, enumProvider)
Sets the enum provider for the specified column index
Parameters:
{Object} columnIndexOrName
index or name of the column
{EnumProvider} enumProvider

setHeaderEditor(columnIndexOrName, cellEditor)
Sets the header cell editor for the specified column index
Parameters:
{Object} columnIndexOrName
index or name of the column
{CellEditor} cellEditor

setHeaderRenderer(columnIndexOrName, cellRenderer)
Sets the column header cell renderer for the specified column index
Parameters:
{Object} columnIndexOrName
index or name of the column
{CellRenderer} cellRenderer

setPageIndex(pageIndex)
Sets the current page (no effect if pageSize is 0)
Parameters:
{Integer} pageIndex
Integer page index

setPageSize(pageSize)
Sets the page size(pageSize of 0 means no pagination)
Parameters:
{Integer} pageSize
Integer page size

setRowAttribute(index, name, value)
Set custom row attribute
Parameters:
{Integer} index
of the row
{String} name
of the attribute
value
of the attribute

setValueAt(rowIndex, columnIndex, value, render)
Sets the value at the specified index
Parameters:
{Integer} rowIndex
{Integer} columnIndex
{Object} value
{Boolean} render

sort(columnIndexOrName, descending, backOnFirstPage)
Sort on a column
Parameters:
{Object} columnIndexOrName
index or name of the column
{Boolean} descending
backOnFirstPage

tableLoaded()
Callback functions

updateChart(divId, chart)
updateChart
Parameters:
divId
chart
Returns:

Documentation generated by JsDoc Toolkit 2.0.1 on Tue Apr 24 2012 13:42:09 GMT+0200 (CEST)