Adding to the HTML RecordGrid

51 views
Skip to first unread message

cc...@papermule.com

unread,
Jan 30, 2016, 10:13:48 AM1/30/16
to Xataface
Hi Steve
It's been a while - glad to see Xataface is still doing well.

I have created a special action viewimage that checks for an image value and
if found adds it into the row as the first column. This works fine for normal record listing.

However, I have another action that opens a new record list as a special SQL select.
Again this works fine, but I can't get the viewimage column to appear.

After the SQL query I display a record grid converted to HTML

      $grid = new Dataface_RecordGrid($data);    // Create new RecordGrid with the data
           
      $body .= $grid->toHTML();    // Get the HTML of the RecordGrid
     
    df_display(array('body' => $body), 'Dataface_Flybox_View.html');

Then in the template I have added what I hoped would fire the viewimage action

    {fill_slot name="main_section"}
   
        {block name="before_record_content"}
        {define_slot name="result_list"}
        {if !$ENV.prefs.use_old_resultlist_controller}
           <div class="result-list-actions">
              {actions_menu id="result-list-actions" id_prefix="result-list-actions-" class="icon-only" category="result_list_actions"}
           </div>
        {/if}
        {$body}
        {/define_slot}

    {/fill_slot}

Am I doing this all wrong or as I suspect that the $body once created can't be changed?

Thanks
Chris

Steve Hannah

unread,
Feb 1, 2016, 11:05:28 AM2/1/16
to xata...@googlegroups.com
Is it that the column doesn't show up at all, or that it just doesn't show the image the way you like?  
If it is the former, then perhaps you should consider using the 2nd parameter of the Dataface_RecordGrid constructor to specify the columns that should be visible.
If the latter, then you can add a cell filter for that column to specify how it should be rendered.
I don't have any examples off hand for cellFilters, but here is where it is called:

Generally just create a function to do the filtering:

function myFilter($row, $col, $value) {
    return '<img src="'.$value.'"/>';
}

Then 

$dataGrid->cellFilters['mycol'] = 'myFilter';

(But if myFilter is defined inside the current class it would be:

$dataGrid->cellFilters['mycol'] = array($this, 'myFilter');

It's a PHP callback... 


Steve

--
You received this message because you are subscribed to the Google Groups "Xataface" group.
Visit this group at https://groups.google.com/group/xataface.
To view this discussion on the web visit https://groups.google.com/d/msgid/xataface/e7957401-46d6-4fcd-bebe-af503ca0543c%40googlegroups.com.



--
Steve Hannah
Web Lite Solutions Corp.

tom wible

unread,
Feb 24, 2026, 12:13:43 PM (21 hours ago) Feb 24
to Xataface
On Monday, February 1, 2016 at 11:05:28 AM UTC-5 wrote:
Is it that the column doesn't show up at all, or that it just doesn't show the image the way you like?  
If it is the former, then perhaps you should consider using the 2nd parameter of the Dataface_RecordGrid constructor to specify the columns that should be visible.
If the latter, then you can add a cell filter for that column to specify how it should be rendered.
I don't have any examples off hand for cellFilters, but here is where it is called:

i have a record linked to a filesystem-stored image...the record display shows the image name & link along with a fileicon.img...how do i get it to display the image itself?

sorry to resurrect an old thread, but new post seems to have disappeared from my browser-\ 
Reply all
Reply to author
Forward
0 new messages