Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Purpose

Set index page table properties, like table entries, color, ...

Context

Controller Context – get_index_label()

...

return either a array with following fields or (for historical reasons) return a string with index/header description:

  Key  Type   Example




indexarrayfields to display on index screen, each array entry is splitted in table <td> segments 
index_headerarraythe corresponding header array for index table view 
bsclassstringbootstrap class of table segments'success', 'warning', 'danger', 'info'
headerstring

string to display in

  • headline for relation context (real breadcrumbs headline (smile))
  • entries in relational blades
 




* @param  - tablename of model
* @paramindex_header - array like [$table.'.column1' , $table.'.column2', ..., 'foreigntable1.column1', 'foreigntable2.column1', ..., 'customcolumn']
* order in index_header is important and datatables will have the column order given here
* @parambsclass - defines a Bootstrap class for colering the Rows
* @paramheader - defines whats written in Breadcrumbs Header at Edit and Create Pages
* @paramedit - array like [$table.'.column1' => 'customfunction', 'foreigntable.column' => 'customfunction', 'customcolumn' => 'customfunction']
* customfunction will be called for every element in table.column, foreigntable.column or customcolumn
* CAREFUL customcolumn will not be sortable or searchable - to use them anyways use the disable_sortsearch key
* @parameager_loading array like [foreigntable1, foreigntable2, ...] - eager load foreign tables
* @paramorder_by array like ['0' => 'asc'] - order table by id in ascending order, ['1' => 'desc'] - order table after first column in descending order
* @paramdisable_sortsearch array like ['customcolumn' => 'false'] disables sorting & searching for the chosen column (e.g. when it is impossible) => prevent errors

 


Info
titleNEW

See for new AJAX implementation:

https://github.com/schmto/nmsprime/pull/26/commits/b621e9ba137d040d4f96a9a0b9b050451fb89f83

...

Tree View

Requirements

parent_id in table

index_tree_view = true in Controller of the MVC

defined parent() and childen() function in model

view_index_label function

Optional

set icon type via $model->get_icon_type()

make entries undeletable via Model::undeletables()

...