Changes between Version 6 and Version 7 of DeveloperGuidelines/DataTables
- Timestamp:
- 06/10/11 08:11:25 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/DataTables
v6 v7 11 11 || dataTable_iDisplayLength \\'''auto''' || The number of rows to be displayed on a page || Integer || Confusion... dataTable_iDisplayLength and iDisplayLength || 12 12 || no_sspag \\'''auto''' || This will turn off pagination || Boolean || Pagination is the default and nothing needs to be done to enable it. || 13 || sortby || This will do an initial sort on the selected column or columns || list of sorting rules. The sorting rules are a list that comprises of the column number followed by the sort direction || default value ![[1,'asc']] ||13 || sortby || This will do an initial sort on the selected column or columns || list of sorting rules. The sorting rules are a list that comprises of the column number followed by the sort direction || default value ![[1,'asc']] if this is changed then you also need to use the orderby attribute which is used to order teh records coming off from the database.|| 14 14 || dataTable_sDom \\'''auto''' || This defines where the controls of the !DataTable will be positioned || String explained in the !DataTables documentation || default value 'fril<"dataTable_table"t>pi' See http://www.datatables.net/usage/options for more information || 15 15 || dataTable_sPaginationType || This defines what controls are displayed to allow the user to page through the records || String either 'two_button' or 'full_numbers' \\default value 'full_numbers' || || … … 54 54 table = db[tablename] 55 55 56 # Pre-processor 57 def prep(r): 58 if r.interactive: 59 s3mgr.configure(r.tablename, 60 deletable=True, 61 addbtn=True) 62 return True 63 64 65 # Post-processor 56 66 def postp(r, output): 57 67 return output … … 139 149 {{{ 140 150 #!div style="font-size: 80%" 141 change to tehdata model:151 The change to the data model: 142 152 {{{#!python 143 153 table = db.define_table(tablename, … … 150 160 }}} 151 161 }}} 152 [[BR]]153 162 [[Image(DataTable_with_Status.png)]] 154 163 [[BR]] … … 164 173 }}} 165 174 }}} 166 [[BR]]167 175 [[Image(DataTable_with_Status_Labels.png)]] 168 176 [[BR]] 169 177 === Sorting by a selected column === 178 To sort a column use the orderby (DAL directive) and sortby (dataTable directive) attributes 179 {{{ 180 #!div style="font-size: 80%" 181 Add this to the prep() function of the controller: 182 {{{#!python 183 s3mgr.configure(r.tablename, 184 deletable=True, 185 addbtn=True, 186 orderby = tablename+".status", 187 sortby = [[3, 'asc']]) 188 }}} 189 }}} 190 [[Image(DataTable_Sorted by_Status.png)]] 191 [[BR]] 170 192 171 193 === Filter Rows ===