2014-11-04 2 views
2

У меня есть таблица со столбцом «read». Я хотел бы иметь возможность сортировать изображение, а не текст, хотя, похоже, не работает.Сортировка таблицы из изображения

Вот что я пробовал:

 <!-- none of these work...--> 

     <th class="read"><?php echo $this->Paginator->sort('read',$this->Html->image("read_no.png", array(
        'width' => "26px", 
        'alt' => "Read", 
        array('escape' => false)))); ?></th> 

     <th class="read"><?php echo $this->Html->link(
      $this->Html->image("read_no.png", array("alt" => "Read")), 
      $this->Paginator->sort('read'), 
      array('escape' => false) 
     );?></th> 

     <th class="read"><?php echo $this->Html->image("read_no.png", array(
        'width' => "26px", 
        'alt' => "Read", 
        'url' => $this->Paginator->sort('read'), 
        array('escape' => false) 
       )); ?> 
     </th> 

Я получаю ошибки, такие как:

 The action <a href=" is not defined in controller 
+0

Если вы установили его в текст, это сработает? –

+0

Вы установили Pagination в контроллере? –

ответ

2

Вы должны добавить опцию бежать к Paginator/сортировки методом, а не HTML/изображение одного :

<th class="read"> 
    <?php 
     $imageTag = $this->Html->image("read_no.png", array(
                 'width' => "26px", 
                 'alt' => "Read", 
                ) 
            ); 
     echo $this->Paginator->sort('read', $imageTag, array('escape' => false)); ?> 
</th> 
Смежные вопросы