Front-end grid - Joomla! Forum - community, help and support


hi,

i'm developping component need show grid data. i've managed add pagination grid when want add sorting, i'm little bit lost. see variable named "lists" , i'm not able pass data because view doesn't can't state variable.

view.html.php

code: select all

$state = &$this->getstate();
$lists['order'] = $state->get('filter_order');       
$lists['order_dir'] = $state->get('filter_order_dir');


on thing need tell i'm using 1 controller component.

the following code show i'm doing , when.

controller.php

code: select all

function display()
   {
      $view = jrequest::getvar('view');
      switch ($view){
         case "grid":
            $this->showgrid();
            break;
         case "form":
            $id = jrequest::getvar('id');
            if ($id != "")
            {
               $formdata = $this->getformdata($id);
               $this->showform($formdata);
            }
            else
            {
               $this->showform();   
            }
            break;
         default:
            $this->showerror(jtext::_("wrong page"));
      }
   }

function showform($formvalue = null)
   {
      // model
      $model =& $this->getmodel('form');
      // view
      $view = $this->getview('form', 'html');
[...] // getting data
// pass data view
      $view->assign($param);
      
      // display view
      $view->display();
}


model class

code: select all

function __construct()
   {
      parent::__construct();
      
      global $mainframe, $option;

      $application = jfactory::getapplication() ;

      $config = jfactory::getconfig() ;

      $this->setstate('limit', $mainframe->getuserstatefromrequest('com_banque.limit', 'limit', $config->getvalue('config.list_limit'), 'int'));
        $this->setstate('limitstart', jrequest::getvar('limitstart', 0, '', 'int'));
      
      // filter request variables
        $this->setstate('filter_order', jrequest::getcmd('filter_order', 'nom'));
        $this->setstate('filter_order_dir', jrequest::getcmd('filter_order_dir', 'asc'));
   }


default.php

code: select all

<th>
    <?php echo jhtml::_('grid.sort',  'custom id', 'id_custom', $this->lists['order_dir'], $this->lists['order'] ); ?>
</th>


can me ?






Comments

Popular posts from this blog

Hur installera Joomla på One.com - Joomla! Forum - community, help and support

removing index.php from URL address - Joomla! Forum - community, help and support

「イメージマップのアンカー名には、...」のエラーが出ないようにしたい