def latest_records(resource, layout, list_id, limit, list_fields, orderby):
 (datalist, numrows, ids) = resource.datalist(fields=list_fields, start=None, limit=limit, list_id=list_id, orderby=orderby, layout=layout)
 if (numrows == 0):
  table = resource.table
  available_records = current.db((table.deleted != True))
  if available_records.select(table._id, limitby=(0, 1)).first():
   msg = DIV(S3CRUD.crud_string(resource.tablename, 'msg_no_match'), _class='empty')
  else:
   msg = DIV(S3CRUD.crud_string(resource.tablename, 'msg_list_empty'), _class='empty')
  data = msg
 else:
  data = datalist.html()
 return data

def latest_records ( resource , layout , list_id , limit , list_fields , orderby ) : ( datalist , numrows , ids ) = resource . datalist ( fields = list_fields , start = None , limit = limit , list_id = list_id , orderby = orderby , layout = layout ) if ( numrows == 0 ) : table = resource . table available_records = current . db ( ( table . deleted != True ) ) if available_records . select ( table . _id , limitby = ( 0 , 1 ) ) . first ( ) : msg = DIV ( S3CRUD . crud_string ( resource . tablename , 'msg_no_match' ) , _class = 'empty' ) else : msg = DIV ( S3CRUD . crud_string ( resource . tablename , 'msg_list_empty' ) , _class = 'empty' ) data = msg else : data = datalist . html ( ) return data
display a datalist of the latest records for a resource .