lookupWidgetPlugin - 0.0.1

Generic lookup widget plugin

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

lookupWidgetPlugin

The lookupWidgetPlugin packages a widget that allows to display a modal popup that lists values from a given table and allows to filter values and to select a value.

This plugin bundles the SimpleModal jQuery plugin http://www.ericmmartin.com/projects/simplemodal/

Installation

  • Install the plugin

    $ symfony plugin:install lookupWidgetPlugin
    
  • Clear the cache

    $ symfony cache:clear
    

Documentation

  • Let's start by defining a schema that looks like this.

    User:
      connection: doctrine
      tableName: appuser
      columns:
        user_id:
          type: integer(4)
          primary: true
          autoincrement: true
        first_name:
          type: string(50)
        last_name:
          type: string(50)
        email:
          type: string(100)
        age:
          type: integer(4)
    
  • Use the lookupWidget in your forms like this :

    public function configure() {
      $this->setWidgets(array(
        'user' => new lookupWidget(array(
          'entity' => 'User',
          'list_columns' => array('first_name', 'last_name', 'email'),
          'filter_columns' => array('first_name', 'last_name', 'age'),
          'select' => 'first_name'
        ))
      ));
    
  • entity : Name of the class to display

  • list_columns : Array of the columns to be displayed on the list.
  • filter_columns : Array of the columns for which to display textfields in the filter form.
  • select : Column chosen to display the link to select the row value.