db.define_table('Degree',
Field('description','string'),
format = '%(description)s'
)
db.define_table('Faculty',
Field('description','string'),
format = '%(description)s'
)
db.define_table('Career',
Field('name','string'),
Field('duration (Years)', 'integer'),
Field('faculty','reference Faculty', requires = IS_IN_DB(db,db.Faculty.id,'%(description)s'),
Field('degree','reference Degree', requires = IS_IN_DB(db,db.Degree.id,'%(description)s')
format= ' %(name)s '
)
Tool/manageCareer.py)def manageCareer():
import json
rows = db((db.Career.faculty == db.Faculty.id)&(db.Career.degree == db.Degree.id)).select()
return dict(results=XML(rows.as_json()))
<script>
var table;
$(document).ready(function(){
table=$('#tableCareers').DataTable( {
'processing': true,
'serverSide': true,
'ajax':
{
type:'POST',
url:"{{=URL('Tool', 'manageCareer')}}",
data:{{=results}},
},
'columns': [
{ data: 'Career.name'},
{ data: 'Career.duration' },
{ data: 'Faculty.description' },
{ data: 'Degree.description' },
],
});
});
</script>
<table id="tableCareers" >
<thead>
<tr>
<th>Name</th>
<th>Duration (Years)</th>
<th>Faculty</th>
<th>Degree</th>
</tr>
</thead>
<tbody></tbody>
</table>
data:{{=results}},--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/CZtFA49nJ18/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/7e0bcbc2-6f9e-499d-bef5-dee93fd6370f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and all its topics, send an email to web...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to web...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/97f23c06-182d-405d-b73c-13cf1f93ebd8%40googlegroups.com.