#NEWLINE# def test_column_ordering( self ) : #NEWLINE# #INDENT# 'Test if a column is orderable.' #NEWLINE# self . populate ( 5 ) #NEWLINE# ( user6 , addr6 ) = self . create_user ( '000_aaa' , 'Whatever' ) #NEWLINE# ( user7 , addr7 ) = self . create_user ( 'zzz_aaa' , 'Whatif' ) #NEWLINE# self . session . add ( user6 ) #NEWLINE# self . session . add ( user7 ) #NEWLINE# self . session . commit ( ) #NEWLINE# columns = self . create_columns ( [ 'id' , 'name' , 'address.description' , 'created_at' ] ) #NEWLINE# req = self . create_dt_params ( order = [ { #NEWLINE# #INDENT# 'column' : 1 , #NEWLINE# 'dir' : 'desc' , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# rowTable = DataTables ( req , User , self . session . query ( User ) . join ( Address ) , columns ) #NEWLINE# res = rowTable . output_result ( ) #NEWLINE# assert ( res [ 'aaData' ] [ 0 ] [ '1' ] == 'zzz_aaa' ) #NEWLINE# req = self . create_dt_params ( order = [ { #NEWLINE# #INDENT# 'column' : 1 , #NEWLINE# 'dir' : 'asc' , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# rowTable = DataTables ( req , User , self . session . query ( User ) . join ( Address ) , columns ) #NEWLINE# res = rowTable . output_result ( ) #NEWLINE# assert ( res [ 'aaData' ] [ 0 ] [ '1' ] == '000_aaa' ) #NEWLINE# req = self . create_dt_params ( order = [ { #NEWLINE# #INDENT# 'column' : 0 , #NEWLINE# 'dir' : 'desc' , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# rowTable = DataTables ( req , User , self . session . query ( User ) . join ( Address ) , columns ) #NEWLINE# res = rowTable . output_result ( ) #NEWLINE# assert ( res [ 'aaData' ] [ 0 ] [ '1' ] == 'zzz_aaa' )