Skip to content
Snippets Groups Projects
Commit cdde7d54 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

The report_4 view use Ext.data.Store instead of Ext.data.ArrayStore.

parent 0634076a
No related branches found
No related tags found
No related merge requests found
......@@ -47,26 +47,30 @@ def report_4():
"""
import json
from plugin_dbui import Store
selector = Selector(virtdb.report4)
cfg = {}
cfg = Store()
cfg.fields = [dict(name='controller', type='string'),
dict(name='host', type='string'),
dict(name='collections', type='string'),
dict(name='ratio', type='number')]
if selector.grouping or selector.grouping_summary:
cfg['groupField'] = 'controller'
cfg['fields'] = [{'name': 'controller', 'type': 'string'},
{'name': 'host', 'type': 'string'},
{'name': 'collections', 'type': 'string'},
{'name': 'ratio', 'type': 'number'}]
cfg.groupField = 'controller'
cfg['data'] = []
cfg.data = []
for row in db().select(db.harvesters.ALL):
cfg['data'].append([row.controller,
'<a href="http://www.web2py.com">%s</a>' % row.host,
# row.host,
row.collections,
row.ratio])
di = dict(controller=row.controller,
host='<a href="http://www.web2py.com">%s</a>' % row.host,
collections=row.collections,
ratio=row.ratio)
cfg['data'].append(di)
return dict(msg="Hello world",
cfg_store=json.dumps(cfg),
......
......@@ -15,11 +15,6 @@
#
response.write(DIV(_id=divgrid))
#
# Export python variables to the javascript
#
jsvars = "var cfgStore = %s;" % cfg_store
response.write(SCRIPT(jsvars), escape=False)
#
# Export python variables to the javascript
#
......@@ -51,7 +46,7 @@
// instantiate the grid
Ext.create('App.grid.Panel', {
plugins: ['pGridExport'],
store: Ext.create('Ext.data.ArrayStore', cfgStore),
store: cfgStore,
columns: [
{text: "Controller", dataIndex: 'controller', flex: 0.8},
{text: "Host", dataIndex: 'host', flex: 1},
......
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