Jump to content

Table Editor


johntp

Recommended Posts

Hey guys I got this script from http://www.phpguru.org/static/TableEditor.html and http://www.phpguru.org/downloads/TableEditor/TableEditor.phps I have it setup how I want it for the most part, but i cannot figure out how to hide the empty fields. I have a noDisplay function I would like to call to but I'm not sure how to do this.

 

my no Display function

       function noDisplay()
       {
           $args = func_get_args();

           foreach ($args as $a) {
               if (isset($this->fields[$a])) {
                   $this->fields[$a]['noDisplay'] = true;
               }
           }
       }

 

how i view the table.

       /**
       * Handles viewing a row
       */
       function handleView($id)
       {
           $quotedId = $this->dbQuote($id);

           foreach ($this->fields as $f => $v) {
               if (empty($v['noDisplay2'])) {
                   $fields[] = $f;
               }
           }

           /**
           * Data filters
           */
           if (!empty($this->dataFilters)) {
               $filters = implode(' AND ', $this->dataFilters);
           } else {
               $filters = 1;
           }


           $fields = implode(', ', $fields);
           list($tables, $joinClause) = $this->getQueryTables();

           $row = $this->dbGetRow("SELECT $fields FROM $tables WHERE $joinClause AND $filters AND {$this->pk} = $quotedId");
           if ($row === false) {
               $this->errors[] = 'Failed to find specified row';
               return;
           }

           $this->parseResults($row);

 

 

I talked to the guy who wrote the script and all he says is

 

If it's the same field all the time, there's something like "hiddenColumns". If not, then define a callback function using AddCallback(). This function ia called just before each row is displayed so you can do anything you want to the row. The row data is passed as an arg. Use this for example:

function RowCallback(&$row)
{
// Manipulate the row here
}

 

but i dont have any clue how to manipulate the row to call noDisplay on fields that are blank.

 

I've been ripping my hair out over this so help is GREATLY Appreciated

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.