Changes between Version 6 and Version 7 of DeveloperGuidelines/DataTables


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

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/DataTables

    v6 v7  
    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']] ||
     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.||
    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' || ||
     
    5454    table = db[tablename]
    5555
     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
    5666    def postp(r, output):
    5767        return output
     
    139149{{{
    140150#!div style="font-size: 80%"
    141 change to teh data model:
     151The change to the data model:
    142152  {{{#!python
    143153    table = db.define_table(tablename,
     
    150160  }}}
    151161}}}
    152 [[BR]]
    153162[[Image(DataTable_with_Status.png)]]
    154163[[BR]]
     
    164173  }}}
    165174}}}
    166 [[BR]]
    167175[[Image(DataTable_with_Status_Labels.png)]]
    168176[[BR]]
    169177=== Sorting by a selected column ===
     178To sort a column use the orderby (DAL directive) and sortby (dataTable directive) attributes
     179{{{
     180#!div style="font-size: 80%"
     181Add 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]]
    170192
    171193=== Filter Rows ===