customize table looks

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

juned_seskoad
Ebase User
Posts: 35
Joined: Mon Jul 14, 2014 11:55 pm

customize table looks

#1

Postby juned_seskoad » Wed Aug 06, 2014 7:23 am

Dear All,

I have 3 question about customizing table looks :

1. There is table control : show select column, but it is multiple select, can it just single select like radio button on table ? or I can add radio button on table ?

2. can I customizing row table like font size, font type, background color etc, can give me some sample code to do it

3. in script assist -> templates, there is
highlight row STYLE
highlight row TABLE rowId STYLE
highlight tablecell FIELD STYLE
highlight field FIELD [on PAGE] STYLE

how to use it, is there any sample code for it ?

Sorry for many question, just want to learn ebase :)

Regards

Juned
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Wed Aug 06, 2014 9:50 am

Juned,

General remark: Ebase has two scripting languages: Javascript and FPL. If you're new to Ebase and have some experience of programming languages, I would use Javascript - it's more powerful and faster to use.

1. Do you mean that the user can only select one row in a table? This is a bit of a strange user interface and is not that easy to achieve. An alternative way of doing this might be to use a single field instead of a table - you could then add a list to this and display it as a list of radio buttons. This would not look the same as a table but might be OK for what you want to achieve. It's certainly much easier to implement.

If you really want to have a single row selector in a table, I think you would need to do this by adding a boolean checkbox column to the table with the immediate validation option set, then write a script that gets control on each click, loop through the table and unset all the other checkboxes - very messy!

2. To set styling properties for an individual row, you need to loop through the table before it's displayed and set whatever properties you need. Note that you are setting properties for individual table cells, not rows. Example (Javascript):

Code: Select all

var rows = tables.MYTABLE.rows;
while (rows.next())
{
   if ( xxxxxxx )      // your condition
   {
      tables.MYTABLE.COLUMN1.backgroundColor = "red";               // set properties for a single table cell
      tables.MYTABLE.COLUMN2.backgroundColor = "red";               // set properties for a single table cell
   }
}

3. In Javascript, you cannot set styling properties for an entire row, you have to set each table cell individually. In FPL, you have the highlight row command which works on an entire row. Example:

Code: Select all

loop at table MYTABLE
  if [ xxx ]
     highlight row CLASS1;
  endif
endloop
Where CLASS1 is a css class defined in a style sheet being used by your form. If you don't already have a style sheet, you can create a new one in the tree under Web Resources and then link it to your form using Form Properties > Web Resources.

If I was doing this, I would use Javascript and approach 2.

Regards
Jon
0 x

juned_seskoad
Ebase User
Posts: 35
Joined: Mon Jul 14, 2014 11:55 pm

#3

Postby juned_seskoad » Wed Aug 06, 2014 1:27 pm

hello Jon

Thanks for your reply and I will try for it.

Regards

Juned
0 x


Who is online

Users browsing this forum: No registered users and 19 guests