Right Align Cell Contents

Discuss MySQL Ajax Table Editor Paid Version

Right Align Cell Contents

Postby orillia319 » Mon May 16, 2011 3:32 pm

I recently purchased the paid version and am in learning mode.

I've tried to use a callback function to format a currency field on the table/list page (I added 'annual_salary' to the employees table in one of the examples). The callback function is as follows:

Code: Select all
function formatCurrencyValue($col,$value,$row)
{
   return '<span style="text-align:right">' . '$' . number_format($value, 2) . '</span>';
}


This style setting seems to be ignored in both Firefox and IE (other non-alignment styling works OK), so perhaps trying to set alignment inside a <td> does not work. Is there another workaround, or perhaps a way to gain access to the <td> tag instead before it's rendered?

Thanks.
orillia319
 
Posts: 6
Joined: Sun May 15, 2011 2:34 pm
Location: Toronto

Re: Right Align Cell Contents

Postby orillia319 » Mon May 16, 2011 3:43 pm

I believe I've solved my own problem.

I had tried defining a class for the style tag, as well as quite a few other options. Just after posting my message, I replaced the span tag with a div and I now have the desired text alignment.

Here's the slightly altered code:

Code: Select all
function formatCurrencyValue($col,$value,$row)
{
   return '<div style="text-align:right">' . '$' . number_format($value, 2) . '</div>';
}

The above works with both Firefox 4 and IE 8.
orillia319
 
Posts: 6
Joined: Sun May 15, 2011 2:34 pm
Location: Toronto

Re: Right Align Cell Contents

Postby vinny1057 » Mon Aug 22, 2011 6:33 pm

very interesting, thanks.
vinny1057
 
Posts: 6
Joined: Thu Aug 18, 2011 1:00 pm


Return to Paid Version

Who is online

Users browsing this forum: No registered users and 1 guest