Contrexx Javascript Framework Views

From Cloudrexx Development Wiki
Jump to: navigation, search

Note: This article is currently a draft. Not all functionalities which are mentioned are already integrated in Cloudrexx

cx.views allows to automatically create client-side views similar to ViewGenerator for server-side. The views are based on a API compatible to Cloudrexx RESTful API. Views can be paged, sorted, filtered and searched. There are a number of configuration options.

Initialize a view

There are two ways to create a view. It can be specified in HTML as a table or generated in JavaScript:

<highlightsyntax>
</highlightsyntax>

<highlightsyntax>var element = cx.views.create(dataObject[, accessKey]);</highlightsyntax>

List of public methods of ViewController (views)

  • cx.views.get() - Get all views
  • cx.views.get(id) - Get a specific view
  • cx.views.create(dataObject[, accessKey]) - Create a new view and return its jQuery element

List of public methods of a View

  • view.setData(data) - Sets data based on a two-dimensional array or object
  • view.getData() - Returns the view's data as a two-dimensional array
  • view.getCellValue(rowNumber, colNumber) - Gets a cell's value
  • view.setCellValue(rowNumber, colNumber, data) - Sets a cell's value
  • view.getRowData(rowNumber) - Gets a row's values as an array
  • view.setRowData(rowNumber, data) - Sets a row's values from an array
  • view.getRowCount() - Number of data entries in this view
  • view.getColumnCount() - Number of fields in this view

Planned methods/features

  • view.setOption(optionName, optionValue)
  • view.getOption(optionName)
  • view.sortBy(columnNumber)
  • view.filter(filter) - Filter by an object with key/value filter pairs
  • view.goToPage(pageNumber)
  • view.goToLastPage() - Alias for view.goToPage(Math.ceil(view.getRowCount() / view.getOption("pagingLimit")))
  • view.goToFirstPage() - Alias for view.goToPage(0)
  • view.search(term) - Search for a term in all columns