RecordGrid-cellFilter bug?

A place for users and developers of the Xataface to discuss and receive support.

RecordGrid-cellFilter bug?

Postby kedoin » Mon Apr 07, 2008 11:35 am

I am using 1.0-beta2

I was experimenting with using cellFilters on a RecordGrid. In my case, I was building an associative array of my own as mentioned in third case of the "Usage" comment in RecordGrid.php.

In my case, I was creating a grid with two columns. The first column had the name of a state. The second column had the number of addresses from the state in column #1. I chose to use a cellFilter because I wanted the number in the second column to be a link which would display all the addresses from that state. Unfortunately, when I went to create the link, I found that I didn't have access to the data in column #1, I only had access to the column #2 data.

The code looks like:
Code: Select all
   133 } else if ( is_array($record) ){
   134         $row = array();
   135         foreach ( $columns as $column){
   136                 if ( $column == RecordGrid_ActionLabel ) continue;
   137                 $row[$column] = @$record[$column];
   138                 if ( isset($this->cellFilters[$column]) ){
   139                         $row[$column] = call_user_func($this->cellFilters[$column], null, $column, $row[$column]);
   140                 }
   141         }


To get what I wanted, I modified line #139 to change the second argument to the call_user_func call. Changing it from "null" to "$row" gave me access so I could find out the value from column #1.

I think using "$row" seems to be consistent with what happens when records are used since the whole $record is passed along to the cellFilter.

Please let me know if this you believe this change will make it into the next release.

Thank you very much.
-Rob
kedoin
 
Posts: 12
Joined: Fri Apr 04, 2008 7:44 am

Postby shannah » Tue Apr 08, 2008 8:47 am

Thanks Rob for this fix. I have posted it in the issue tracker and made the change in SVN.


Best regards

Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 17 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved