Highligting Current Record

Questions and answers for designing and implementing forms in Servoy

Postby ahmad » Tue Feb 03, 2004 2:04 pm

Since the calculation suggestion is the most powerfull, we prefer that one.


Let's go for the powerful one.. Hope there won't be any performance issue under networked solutions with huge records
ahmad
 
Posts: 139
Joined: Wed Dec 24, 2003 12:01 pm
Location: Hong Kong

Postby Jan Blok » Tue Feb 03, 2004 5:58 pm

ahmad wrote:Hope there won't be any performance issue under networked solutions with huge records

There will be none, the calc is only be executed for visible records.
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby Harjo » Wed Feb 11, 2004 12:09 pm

Will this be implemented in RC5?
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby jcompagner » Wed Feb 11, 2004 12:30 pm

yes
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8865
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby faheemhameed » Thu Feb 12, 2004 10:39 am

Hi there,

I am unsure how to do highlighting records. A method is called during "onRecordSelection" event or what? Can someone explain the process?

Thanks
Hameed
User avatar
faheemhameed
 
Posts: 763
Joined: Wed Sep 10, 2003 7:23 am

Postby maarten » Thu Feb 12, 2004 11:22 am

sure,

the highlighting isn't triggered by an event script.
In fact in works with an unstored calculation with a specific naming:
"servoy_row_bgcolor".
If you create a calculation with this name it will automatically starts influencing your row color.

The calculation works on all visible rows in your form:
Code: Select all
var recordIndex = arguments[0]; // gets the index of the record
var selected = arguments[1]; //checks if this record is currently selected
if (selected)
{
   return '#CCCCEE';
}
else
{
   if (recordIndex % 2 == 0)//alternate on even oneven
   {
      return '#0000FF';
   }
   else
   {
      return '#FF0000';
   }
}
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby patrick » Thu Feb 12, 2004 11:44 am

Hi! I have just tried the new possibilty and it does work great! Thanks!

There is one issue, though. The function also changes the background color of my controller. So depending on the record you touch, the controller changes its colour everytime. This looks a little odd... Is this fixable?
patrick
 
Posts: 3708
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby jcompagner » Thu Feb 12, 2004 11:56 am

yes for now don't base the controller on the same table..
use dummy
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8865
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby faheemhameed » Thu Feb 12, 2004 12:21 pm

I am displaying a found set of a table (for ex: table_A) in a tab panel as list. That tab panel is in a form and that form is linked to the same table_A.

The "servoy_row_bgcolor" effects both the form and list in the tab panel. That's is correct. But I want the servoy_row_bgcolor to take effect only in the list layout of the tab panel.

I think if we can have arguments[2] that could return the current form name. We can return the background color only if the form name is so and so.

Please advise.

Thanks
Hameed
User avatar
faheemhameed
 
Posts: 763
Joined: Wed Sep 10, 2003 7:23 am

Postby patrick » Thu Feb 12, 2004 12:23 pm

yes for now don't base the controller on the same table..
use dummy


that is tricky to do, because I have some controller-driven logic in my controller.

That leads to a question that we have discussed before via mail: does a controller need a dataprovider or wouldn't it be easier if the controller always refers to the dataprovider of the form that it controls?

I always have a problem to pass information between controller and form that reside on the same dataprovider. Under certain circumstances these two get "out of synch". I wonder if we could do without these issues if the controller refered always to the data provider of the controlled form.[/quote]
patrick
 
Posts: 3708
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby jcompagner » Thu Feb 12, 2004 3:00 pm

what kind of things do you use in your custom controller so that it has to be based on the same table?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8865
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby patrick » Thu Feb 12, 2004 4:26 pm

for example a record count (1/20 that sort of thing)...
patrick
 
Posts: 3708
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby patrick » Thu Feb 12, 2004 6:56 pm

another issue: since the background color also applies to my controller of course it does the same to my single record view, which is definetly not nice. I think this should only be calculated for forms in list or table view.
patrick
 
Posts: 3708
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby Jan Blok » Thu Feb 12, 2004 8:31 pm

We realize the current method is not fine grained enough, in a later version of Servoy we will add the property 'rowBGColorCalculation' to a form and a portal, to make it fully adjustable.
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby pbakker » Sat Feb 14, 2004 6:43 pm

Could we also get "servoy_row_fgcolor"??? :lol:

BTW: as for the rowcolor showing on every form based on the table where you add the calculated field: As a work around I added another if-then-else clause int he calculation, in which I evaluate the value of a global, which caries the current formname. If the formname is one of the ones I do not want to use the highlightning for, I just set the color to the normal background color.

Dunno if you could make this work for a controller though. Sadly, the getName function is not available in the calculation area.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

PreviousNext

Return to Forms

Who is online

Users browsing this forum: No registered users and 3 guests