Jump to content

Help with table formatting


Recommended Posts

I am working on a table and am new to formatting and alignment etc. What I would like to do is format my date (MM/dd/yyyy), amounts (add $) and keep the first 2 column left aligned but right align the last 3 columns. Any help would be appreciated!

 

var table = new FPTable();

table.AddColumns(8000,29500,7000,7000,5700);

 

var data = FusionPro.GetMultiLineRecords();

 

for (var rec = 1; rec <= data.recordCount; rec++) {

function ExField(str) { return '<p br=false linespacing=0.8>' + TaggedTextFromRaw(data.GetFieldValue(rec, str)); }

 

var content = ["Trx_Date_From","Description","ApprovedAmt", "Payments","Balance"].map(ExField);

var row = table.AddRow();

var [cell] = row.Cells;

 

cell.Margins = { 'Top': 1, 'Bottom': 1, 'Left': 0, 'Right': 0 };

cell.VAlign = 'Bottom';

 

row.CopyCells(0, 1, 2, 3, 4);

row.minHeight = 15 * 100; // 15 pt row height.

row.SetContents.apply(row, content);

}

 

return table.MakeTags();

Link to comment
Share on other sites

First, if you're using FusionPro 11.1, then you can make this table, formatting and all, without writing a single line of JavaScript.

 

In older versions, you can just break out that call to row.SetContents() with multiple parameters, just like in this post:

http://forums.pti.com/showpost.php?p=23869&postcount=12

 

In your case, I don't have your data, so I can't validate the code, but I think you want to do this:

 row.SetContents(
   FormatDate(ExField("Trx_Date_From"), "MM/dd/yyyy"),
   ExField("Description"),
   "$" + ExField("ApprovedAmt"),
   "$" + ExField("Payments"),
   "$" + ExField("Balance")
 );

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...