Basic usage of table - Table is created on the fly
Basic usage of table - Table is created on the fly
gliese581g
Posts: 1Questions: 0Answers: 0
I am using this plugin for the first time. I am developing an application using web2py framework of python. This application has a view(.html) file. I am creating a dynamic table in it by using python code blocks in between. I want this table to have sorting and paging capabilities. I have downloaded datatables plugin andplaced it in my application. The code which I have inclided in html file is given below:
[code]
Login
$(document).ready(function() {
$('#example').dataTable();
} );
ID
Method
Date
Status
Account
Name
Amount1
Amount2
Type
{{try:
for obj in result['output']:
}}
{{=obj['id']}}
{{=obj['method']}}
{{=obj['date']}}
{{=obj['status']}}
{{=obj['account']}}
{{=obj['name']}}
{{=obj['amount1']}}
{{=obj['amount2']}}
{{=obj['type']}}
{{else:}}
No Data Available
{{pass}}
{{except:
pass}}
[/code]
Paging and sorting is not working on the table. Please correct me if I am doing anything wrong over here.
*- Content written between curly braces (ex- {{pass}}) is Python code which web2py evaluates at run time.
[code]
Login
$(document).ready(function() {
$('#example').dataTable();
} );
ID
Method
Date
Status
Account
Name
Amount1
Amount2
Type
{{try:
for obj in result['output']:
}}
{{=obj['id']}}
{{=obj['method']}}
{{=obj['date']}}
{{=obj['status']}}
{{=obj['account']}}
{{=obj['name']}}
{{=obj['amount1']}}
{{=obj['amount2']}}
{{=obj['type']}}
{{else:}}
No Data Available
{{pass}}
{{except:
pass}}
[/code]
Paging and sorting is not working on the table. Please correct me if I am doing anything wrong over here.
*- Content written between curly braces (ex- {{pass}}) is Python code which web2py evaluates at run time.
This discussion has been closed.
Replies
Allan