Changes between Version 7 and Version 8 of DeveloperGuidelines/DataTables


Ignore:
Timestamp:
06/10/11 08:56:14 (14 years ago)
Author:
graeme
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/DataTables

    v7 v8  
    1111|| dataTable_iDisplayLength \\'''auto''' || The number of rows to be displayed on a page || Integer || Confusion... dataTable_iDisplayLength and iDisplayLength ||
    1212|| 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']] 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.||
     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 the records coming off from the database.||
    1414|| 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 ||
    1515|| 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' || ||
     
    190190[[Image(DataTable_Sorted by_Status.png)]]
    191191[[BR]]
    192 
    193 === Filter Rows ===
    194192=== Selecting Rows ===
     193It is possible to select multiple rows by setting the all this requires is to set the dataTableSelectable attribute
     194{{{
     195#!div style="font-size: 80%"
     196Add this to the prep() function of the controller:
     197  {{{#!python
     198        response.s3.dataTableSelectable = True
     199  }}}
     200}}}
     201[[Image(DataTable_with_Selected_Rows.png)]]
     202[[BR]]
    195203=== Highlighting Rows ===
     204You can highlight rows. For example set an alert if the file has already been imported or set a warning if the file is more than 60 days old.
     205{{{
     206#!div style="font-size: 80%"
     207Add this to the prep() function of the controller:
     208  {{{#!python
     209        # Display an Alert if the file has already been imported
     210        query = (r.table.status == 2)
     211        rows = db(query).select(r.table.id)
     212        response.s3.dataTableStyleAlert = [str(row.id) for row in rows]
     213        # Display a Warning if the file is more than 60 days old
     214        warningDate = datetime.now() - timedelta(days=60)
     215        query = (r.table.created_on < warningDate)
     216        rows = db(query).select(r.table.id)
     217        response.s3.dataTableStyleWarning = [str(row.id) for row in rows]
     218  }}}
     219}}}
     220[[Image(DataTable_with_Highlighting.png)]]
     221[[BR]]
    196222=== Highlighting Cells ===
     223Not Yet Implemented