Phalcon HTML table sort component

Phalcon HTML table sort component

README

Phalcon HTML table sort component

Requirements

  • Phalcon v1.4.x

Installing

Install using Composer:

{
	"require": {
		"mattdanger/phalcon-table-sort": "dev-master"
	}
}

You’ll also need to add each function to the Volt service:

$di->set('view', function () use ($config) {

  $view = new View();
  // ...
  $view->registerEngines(array(
    '.volt' => function ($view, $di) use ($config) {

      $volt = new VoltEngine($view, $di);

      $volt->getCompiler()->addFunction('sortLink', function ($resolvedArgs, $expArgs) {
        return 'TableSortSort::sortLink(' . $resolvedArgs . ')';
      });
      $volt->getCompiler()->addFunction('sortIcon', function ($resolvedArgs, $expArgs) {
        return 'TableSortSort::sortIcon(' . $resolvedArgs . ')';
      });
      // ... 

      return $volt;
    },
    // ...
  ));

  return $view;

});

Using Helpers

Here’s a list of what’s included:

sortLink($key, $default_sort = 'ASC')

Return a formatted URI string with sort order

sortIcon($key, $default = FALSE)

Return a sort icon

Source

Add a Comment

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *