Hello everybody, I'm trying to make my table ordered data.
I implemented the code below, but I don't understand what do I do with the query ....
For now, the header of the table is sortable by all fields ( the arrow appears to choose whether to order ASC or Disc), but I did not understand how to implement the query to do so.
here's the code:
<?php
function provaOrdinamento_menu(){
$items['ordina']= array(
'title'=> 'Prova Ordinamento',
'page callback'=> 'get_ticket',
'access callback'=>TRUE,
);
return $items;
};
function get_ticket(){
$output = drupal_get_form('provaOrdinamento_form');
return $output;
};
function provaOrdinamento_form($node, &$form_state, $filtro1=NULL, $filtro2=NULL){
$tickets = get_tickets();
$form['tickets']= array(
'#type'=>'value',
'#value'=> $tickets,
'#theme' => 'tabella_provaOrdinamento',
);
return $form;
};
function provaOrdinamento_theme(){
return array(
'tabella_provaOrdinamento' => array(
array('render element' => 'tickets')),
);
}
function get_tickets(){
$rows = array();
$result= "";
$query= db_select("rgls_ticket", "r");
$query->fields("r", array("id","titolo", "descrizione"));
$query->extend('TableSort');
$result = $query->execute();
foreach ($result as $node) {