Via a response after a form selection I call:
response.js = "jQuery(web2py_component('%s','graph3'))" % ( URL('graphs',
'graph3') )
then in:
def graph3():
.... left out some code ...
... json format is tested and OK ...
df_drill_asr_to_json = df_drill_asr.to_json(orient='records',
date_format='iso')
return dict(df_drill_asr_to_json=df_drill_asr_to_json)
then in graph3.load
<div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
<div id="jqxgrid"></div>
</div>
<script type="text/javascript">
$(document).ready(function () {
var data = '{{=XML(df_drill_asr_to_json)}}'
// prepare the data
var source =
{
datatype: "json",
datafields: [
{ name: 'Event type', type: 'string' },
{ name: 'Descriptor', type: 'string' },
{ name: 'Risk', type: 'string' },
{ name: 'ASR title', type: 'string' },
{ name: 'Phase', type: 'string' },
{ name: 'Date', type: 'date' },
{ name: 'Flight', type: 'string' },
{ name: 'Dep', type: 'string' },
{ name: 'Arr', type: 'string' }
],
localdata: data
};
var dataAdapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid(
{
width: 850,
source: dataAdapter,
columnsresize: true,
sortable: true,
filterable: true,
showfilterrow: true,
columns: [
{ text: 'Event type', datafield: 'Event type' },
{ text: 'Descriptor', datafield: 'Descriptor' },
{ text: 'Risk',datafield: 'Risk' },
{ text: 'ASR title',datafield: 'ASR title' },
{ text: 'Phase',datafield: 'Phase' },
{ text: 'Date',datafield: 'Date' },
{ text: 'Flight',datafield: 'Flight' },
{ text: 'Dep',datafield: 'Dep' },
{ text: 'Arr',datafield: 'Arr' }
]
});
});
</script>
via F12 in chrome (and in other browsers as well) I get the error :
Uncaught TypeError: Cannot read property 'dataAdapter' of undefined in line
: var dataAdapter = new $.jqx.dataAdapter(source);
The jqwidgets js library is in the static folder.
The <script src="{{=URL('static','js/jqx-all.js')}}"></script> is in the
layout.html just after web2py_bootstrap.js import.
I placed the src script in the index.html and in the graph3.load and each
time the same error.
What is wrong ?
Thank
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.