Skip to content
Snippets Groups Projects
Commit 7e2b5279 authored by tux091's avatar tux091
Browse files

Add a the possibility to activate row numbering in grid via the GridModifier.

parent 4845fdd0
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,7 @@ formModifier.configure(buttonAlign='right',
#
gridModifier = dbui.GridModifier('categories')
gridModifier.configure_column('code', width=10)
gridModifier.set_rownumbering()
#
# Define a column template for the publications grid
......
......@@ -117,6 +117,10 @@ class CvtSvc(BaseSvc):
delete_columns = grid_modifiers[tablename].delete_columns
template_columns = grid_modifiers[tablename].template_columns
# row numbering in the first colum,
if grid_modifiers[tablename].row_numbering:
models.append({'xtype': 'rownumberer'})
# standard column
for field in table:
fieldname = field.name
......
......@@ -52,7 +52,9 @@ class GridModifier(Modifier):
self.data.delete_columns = []
self.data.grid_filters = []
self.data.hidden_columns = []
self.data.row_numbering = False
self.data.template_columns = []
def add_column(self, ktable, kfield, position=0, extjs={}):
......@@ -167,3 +169,11 @@ class GridModifier(Modifier):
"""
self.data.grid_filters = Storage(filters=filters, extjs=kwargs)
def set_rownumbering(self):
"""Activate the row numbering.
Row number is displayed in the first column of the grid.
"""
self.data.row_numbering = True
......@@ -19,6 +19,25 @@ App.grid.Grid = Ext.extend(Ext.grid.GridPanel, {
*/
rowEditor: null,
/**
* Constructor
*
* NOTE:
* Required in ExtJS 3.4 convert rownumberer xtype
* into an Ext.grid.RowNumberer. Not needed in ExtJS 4
*
*/
constructor: function (config) {
var first_column = config.columns[0];
if ('xtype' in first_column && first_column.xtype === 'rownumberer') {
config.columns[0] = new Ext.grid.RowNumberer();
}
Ext.apply(this, config);
App.grid.Grid.superclass.constructor.call(this);
},
/**
* private method requests by the component model of ExtJS
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment