title: Formatting tables generated with PHP/PEAR Structures_DataGrid & HTML_Table
body: <p>I've been working through some examples in a book using pear for the first time... so far it seems pretty cool, but I'm having a small problem where I need to tweak the formatting of one particular column of the table generated from Structures_DataGrid &amp; HTML_Table - specifically I need it to not wrap the text in a cell at the hyphen - which I think I could do using 'nowrap' and html/css - but so far I'm not seeing how to pass that sort of formatting to just <em>one</em> column in the table...</p>
  
  <p>Any suggestions?</p>
  
  <p>Added source code below:</p>
  
  <pre><code>    &lt;?php
    // Include the DB access credentials
    require 'dbcred.php';
  
    // Include the PEAR Structures_DataGrid class
    require 'Structures/DataGrid.php';
  
    // instantiate grid for 10 records per page
    $datagrid = new Structures_DataGrid(10);
  
    // Define our Datasource options, in this case PDO MySQL
    $options = array('dsn' =&gt; "mysql://$user:$password@$db_host/$db_name");
  
    // Define the Query
    $sql = "SELECT * FROM contact_info";
  
    // Bind the Query to our Datagrid
    $bind = $datagrid-&gt;bind($sql, $options);
    // Test for Errors
    if (PEAR::isError($bind))
    {
      /*error_log('DataGrid Error: '. $bind-&gt;getMessage());
      $gridsource = 'Foo';*/
      echo $bind -&gt; getMessage();
    }
    else
    {
      // Define our Column labels, using a 'column' =&gt; 'Label' format
      $columns = array(
          'title' =&gt; 'Title',
          'first_name' =&gt; 'First Name',
          'mid_init' =&gt; 'Mid. Init.',
          'last_name' =&gt; 'Last Name',
          'suffix' =&gt; 'Suffix',
          'street_address' =&gt; 'Street Address',
          'city' =&gt; 'City',
          'state_prov' =&gt; 'State/Province',
          'post_code' =&gt; 'Postal Code',
          'phone_pri' =&gt; 'Phone (Pri)',
          'phone_alt' =&gt; 'Phone (Alt)',
          'email' =&gt; 'E-Mail',
      );
      $datagrid-&gt;generateColumns($columns);
      // Some more options, for our renderer
      $renderer_options = array(
          'sortIconASC' =&gt; '&amp;uArr;',
          'sortIconDESC' =&gt; '&amp;dArr;',
          'headerAttributes' =&gt; array('bgcolor' =&gt; '#E3E3E3'),
          'evenRowAttributes' =&gt; array('bgcolor' =&gt; '#A6A6A6'),
      );
      $datagrid-&gt;setRendererOptions($renderer_options);
  
      // Add some final attributes to our table
      $renderer = $datagrid-&gt;getRenderer();
      $renderer-&gt;setTableAttribute('cellspacing', 0);
      $renderer-&gt;setTableAttribute('cellpadding', 5);
      $renderer-&gt;setTableAttribute('border', 1);
      // Render the table, be sure to check for errors 
      $gridbody = $datagrid-&gt;getOutput();
      if (PEAR::isError($gridbody))
      {
        error_log('DataGrid render error: ' . $gridbody-&gt;getMessage());
        $gridbody = '';
      }
      // Finally, render the pager, again checking for errors
      $gridpager = $datagrid-&gt;getOutput(DATAGRID_RENDER_PAGER);
      if (PEAR::isError($gridpager))
      {
        error_log('DataGrid render error: ' . $gridpager-&gt;getMessage());
        $gridpager = '';
      }
      $gridsource = $gridbody . $gridpager;
    }
  ?&gt;
  &lt;!DOCTYPE html public "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
      &lt;title&gt;PEAR::Structures_DataGrid&lt;/title&gt;
      &lt;meta http-equiv="Content-type"
          content="text/html; charset=iso-8859-1" /&gt;
      &lt;style type="text/css"&gt;
        body {
          font-family: Tahoma, Arial, Helvetica, sans-serif;
          font-size: 11px;
        }
        h1 {
          font-size: 1.2em;
          color: navy
        }
        th {
            white-space: no-wrap;
        }
      &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;PEAR::Structures_DataGrid&lt;/h1&gt;
      &lt;?php echo $gridsource ?&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>