Page 1 of 1

Grid cell borders

Posted: Wed Nov 25, 2020 12:37 pm
by BFoster
I have a user requesting a red border color around individual grid input-fields when the input-field gets focus and of course when the field is blurred remove the red border. It's a high volume application and the user is looking at a document for the value and wants the field she is working to have its border outlined in red. I'm doing it for the control record input-fields using the onfocus and onblur events. That approach doesn't seem to apply with a grid. Is this even possible?

Re: Grid cell borders

Posted: Wed Nov 25, 2020 1:10 pm
by Scott Klement
onfocus/onblur work the same in grids as anywhere else...

Re: Grid cell borders

Posted: Mon Nov 30, 2020 11:53 am
by BFoster
You referred to grid in your reply. I am trying to change the border color of a cell when that cell receives focus. I do not see any grid methods that fits the bill.

This is the JS code I'm using for an input-capable field in the control record. This approach does not work for a subfile field as the method "applyProperty" is not available for a grid object.

applyProperty("C1TOTCHRGE", "border bottom color", "#FF3366");
applyProperty("C1TOTCHRGE", "border left color", "#FF3366");
applyProperty("C1TOTCHRGE", "border right color", "#FF3366");
applyProperty("C1TOTCHRGE", "border top color", "#FF3366");

applyProperty("C1TOTCHRGE", "border bottom width", "medium");
applyProperty("C1TOTCHRGE", "border left width", "medium");
applyProperty("C1TOTCHRGE", "border right width", "medium");
applyProperty("C1TOTCHRGE", "border top width", "medium");

Re: Grid cell borders

Posted: Mon Nov 30, 2020 12:17 pm
by Scott Klement
The IDs of fields in a grid are suffixed with the row number. So "C1TOTCHRGE.1" for row 1, "C1TOTCHRGE.2" for row 2, etc. Aside from that, applyProperty() works exactly the same in the grid as it does outside of the grid.

Re: Grid cell borders

Posted: Mon Nov 30, 2020 12:46 pm
by BFoster
Ah! Thanks, Scott.

Re: Grid cell borders

Posted: Mon Nov 30, 2020 3:01 pm
by BFoster
One more: This is sort of a chicken and egg relationship. All of the grid methods require RRN to isolate a row and the same RRN is used to change a field's border property. When the onfocus event fires due to a user selecting or more central to the problem - tabbing into - a subfile field, how is RRN obtained?

Re: Grid cell borders

Posted: Mon Nov 30, 2020 4:23 pm
by Scott Klement
It will automatically define variables named rowNumber and rrn
  • rowNumber = physical row number on the screen. This will change when you sort the grid.
  • rrn = the original row number (and the one that your server-side code uses to refer to rows). This sticks with the row when you sort the grid. This is probably what you want to use, here.
So you should be able to code it like this:

Code: Select all

applyProperty("C1TOTCHRGE." + rrn, "border bottom color", "#FF3366");

Re: Grid cell borders

Posted: Tue Dec 01, 2020 8:07 am
by BFoster
Once again, thanks, Scott.